Browse Source

Fixed code coverage of MutationObserver.

Szymon Kupś 9 years ago
parent
commit
e27cbdbbfc
1 changed files with 11 additions and 0 deletions
  1. 11 0
      packages/ckeditor5-engine/tests/view/observer/mutationobserver.js

+ 11 - 0
packages/ckeditor5-engine/tests/view/observer/mutationobserver.js

@@ -49,6 +49,17 @@ describe( 'MutationObserver', () => {
 		expect( lastMutations[ 0 ].oldText ).to.equal( 'foo' );
 		expect( lastMutations[ 0 ].oldText ).to.equal( 'foo' );
 	} );
 	} );
 
 
+	it( 'should not observe if disabled', () => {
+		const additional = document.getElementById( 'additional' );
+		mutationObserver.disable();
+		viewDocument.createRoot( additional, 'additional' );
+
+		additional.textContent = 'foobar';
+		mutationObserver.flush();
+
+		expect( lastMutations ).to.be.null;
+	} );
+
 	it( 'should handle bold', () => {
 	it( 'should handle bold', () => {
 		domEditor.childNodes[ 0 ].childNodes[ 0 ].data = 'f';
 		domEditor.childNodes[ 0 ].childNodes[ 0 ].data = 'f';
 		const domB = document.createElement( 'b' );
 		const domB = document.createElement( 'b' );