8
0
Просмотр исходного кода

Tests: Fixed a selection observer test which could never work, but was hard to find because it depended on how you executed the tests.

Piotrek Koszuliński 9 лет назад
Родитель
Сommit
8a11dc9bfe

+ 7 - 0
packages/ckeditor5-engine/tests/view/observer/selectionobserver.js

@@ -120,7 +120,14 @@ describe( 'SelectionObserver', () => {
 	it( 'should not fired if there is no focus', ( done ) => {
 		viewDocument.isFocused = false;
 
+		// changeDomSelection() may focus the editable element (happens on Chrome)
+		// so cancel this because it sets the isFocused flag.
+		viewDocument.on( 'focus', ( evt ) => evt.stop(), { priority: 'highest' } );
+
 		viewDocument.on( 'selectionChange', () => {
+			// Validate the correctness of the test. May help tracking issue with this test.
+			expect( viewDocument.isFocused ).to.be.false;
+
 			throw 'selectionChange on render';
 		} );