|
@@ -404,7 +404,7 @@ describe( 'MutationObserver', () => {
|
|
|
|
|
|
|
|
mutationObserver.flush();
|
|
mutationObserver.flush();
|
|
|
|
|
|
|
|
- expect( lastMutations.length ).to.equal( 0 );
|
|
|
|
|
|
|
+ expect( lastMutations ).to.be.null;
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'should ignore mutation with bogus br inserted on the end of the paragraph with text', () => {
|
|
it( 'should ignore mutation with bogus br inserted on the end of the paragraph with text', () => {
|
|
@@ -417,7 +417,7 @@ describe( 'MutationObserver', () => {
|
|
|
|
|
|
|
|
mutationObserver.flush();
|
|
mutationObserver.flush();
|
|
|
|
|
|
|
|
- expect( lastMutations.length ).to.equal( 0 );
|
|
|
|
|
|
|
+ expect( lastMutations ).to.be.null;
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'should ignore mutation with bogus br inserted on the end of the paragraph while processing text mutations', () => {
|
|
it( 'should ignore mutation with bogus br inserted on the end of the paragraph while processing text mutations', () => {
|
|
@@ -449,7 +449,7 @@ describe( 'MutationObserver', () => {
|
|
|
|
|
|
|
|
mutationObserver.flush();
|
|
mutationObserver.flush();
|
|
|
|
|
|
|
|
- expect( lastMutations.length ).to.equal( 0 );
|
|
|
|
|
|
|
+ expect( lastMutations ).to.be.null;
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
// This case is more tricky than the previous one because DOMConverter will return a different
|
|
// This case is more tricky than the previous one because DOMConverter will return a different
|
|
@@ -528,6 +528,7 @@ describe( 'MutationObserver', () => {
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
describe( 'UIElement integration', () => {
|
|
describe( 'UIElement integration', () => {
|
|
|
|
|
+ const renderStub = sinon.stub();
|
|
|
function createUIElement( name ) {
|
|
function createUIElement( name ) {
|
|
|
const element = new UIElement( name );
|
|
const element = new UIElement( name );
|
|
|
|
|
|
|
@@ -546,6 +547,8 @@ describe( 'MutationObserver', () => {
|
|
|
viewRoot._appendChild( uiElement );
|
|
viewRoot._appendChild( uiElement );
|
|
|
|
|
|
|
|
view.forceRender();
|
|
view.forceRender();
|
|
|
|
|
+ renderStub.reset();
|
|
|
|
|
+ view.on( 'render', renderStub );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'should not collect text mutations from UIElement', () => {
|
|
it( 'should not collect text mutations from UIElement', () => {
|
|
@@ -553,7 +556,15 @@ describe( 'MutationObserver', () => {
|
|
|
|
|
|
|
|
mutationObserver.flush();
|
|
mutationObserver.flush();
|
|
|
|
|
|
|
|
- expect( lastMutations.length ).to.equal( 0 );
|
|
|
|
|
|
|
+ expect( lastMutations ).to.be.null;
|
|
|
|
|
+ } );
|
|
|
|
|
+
|
|
|
|
|
+ it( 'should not cause a render from UIElement', () => {
|
|
|
|
|
+ domEditor.childNodes[ 2 ].childNodes[ 0 ].data = 'foom';
|
|
|
|
|
+
|
|
|
|
|
+ mutationObserver.flush();
|
|
|
|
|
+
|
|
|
|
|
+ expect( renderStub.callCount ).to.be.equal( 0 );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'should not collect child mutations from UIElement', () => {
|
|
it( 'should not collect child mutations from UIElement', () => {
|
|
@@ -562,7 +573,16 @@ describe( 'MutationObserver', () => {
|
|
|
|
|
|
|
|
mutationObserver.flush();
|
|
mutationObserver.flush();
|
|
|
|
|
|
|
|
- expect( lastMutations.length ).to.equal( 0 );
|
|
|
|
|
|
|
+ expect( lastMutations ).to.be.null;
|
|
|
|
|
+ } );
|
|
|
|
|
+
|
|
|
|
|
+ it( 'should not cause a render when UIElement gets a child', () => {
|
|
|
|
|
+ const span = document.createElement( 'span' );
|
|
|
|
|
+ domEditor.childNodes[ 2 ].appendChild( span );
|
|
|
|
|
+
|
|
|
|
|
+ mutationObserver.flush();
|
|
|
|
|
+
|
|
|
|
|
+ expect( renderStub.callCount ).to.be.equal( 0 );
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|
|
|
|
|
|