@@ -404,7 +404,7 @@ describe( 'MutationObserver', () => {
404
404
405
405
mutationObserver . flush ( ) ;
406
406
407
- expect ( lastMutations . length ) . to . equal ( 0 ) ;
407
+ expect ( lastMutations ) . to . be . null ;
408
408
} ) ;
409
409
410
410
it ( 'should ignore mutation with bogus br inserted on the end of the paragraph with text' , ( ) => {
@@ -417,7 +417,7 @@ describe( 'MutationObserver', () => {
417
417
418
418
mutationObserver . flush ( ) ;
419
419
420
- expect ( lastMutations . length ) . to . equal ( 0 ) ;
420
+ expect ( lastMutations ) . to . be . null ;
421
421
} ) ;
422
422
423
423
it ( 'should ignore mutation with bogus br inserted on the end of the paragraph while processing text mutations' , ( ) => {
@@ -449,7 +449,7 @@ describe( 'MutationObserver', () => {
449
449
450
450
mutationObserver . flush ( ) ;
451
451
452
- expect ( lastMutations . length ) . to . equal ( 0 ) ;
452
+ expect ( lastMutations ) . to . be . null ;
453
453
} ) ;
454
454
455
455
// This case is more tricky than the previous one because DOMConverter will return a different
@@ -528,6 +528,7 @@ describe( 'MutationObserver', () => {
528
528
} ) ;
529
529
530
530
describe ( 'UIElement integration' , ( ) => {
531
+ const renderStub = sinon . stub ( ) ;
531
532
function createUIElement ( name ) {
532
533
const element = new UIElement ( name ) ;
533
534
@@ -546,14 +547,24 @@ describe( 'MutationObserver', () => {
546
547
viewRoot . _appendChild ( uiElement ) ;
547
548
548
549
view . forceRender ( ) ;
550
+ renderStub . reset ( ) ;
551
+ view . on ( 'render' , renderStub ) ;
549
552
} ) ;
550
553
551
554
it ( 'should not collect text mutations from UIElement' , ( ) => {
552
555
domEditor . childNodes [ 2 ] . childNodes [ 0 ] . data = 'foom' ;
553
556
554
557
mutationObserver . flush ( ) ;
555
558
556
- expect ( lastMutations . length ) . to . equal ( 0 ) ;
559
+ expect ( lastMutations ) . to . be . null ;
560
+ } ) ;
561
+
562
+ it ( 'should not cause a render from UIElement' , ( ) => {
563
+ domEditor . childNodes [ 2 ] . childNodes [ 0 ] . data = 'foom' ;
564
+
565
+ mutationObserver . flush ( ) ;
566
+
567
+ expect ( renderStub . callCount ) . to . be . equal ( 0 ) ;
557
568
} ) ;
558
569
559
570
it ( 'should not collect child mutations from UIElement' , ( ) => {
@@ -562,7 +573,16 @@ describe( 'MutationObserver', () => {
562
573
563
574
mutationObserver . flush ( ) ;
564
575
565
- expect ( lastMutations . length ) . to . equal ( 0 ) ;
576
+ expect ( lastMutations ) . to . be . null ;
577
+ } ) ;
578
+
579
+ it ( 'should not cause a render when UIElement gets a child' , ( ) => {
580
+ const span = document . createElement ( 'span' ) ;
581
+ domEditor . childNodes [ 2 ] . appendChild ( span ) ;
582
+
583
+ mutationObserver . flush ( ) ;
584
+
585
+ expect ( renderStub . callCount ) . to . be . equal ( 0 ) ;
566
586
} ) ;
567
587
} ) ;
568
588
0 commit comments