@@ -490,13 +490,30 @@ void main() {
490
490
beforeEachModule ((Module module) {
491
491
module.type (ExceptionHandler , implementedBy: LoggingExceptionHandler );
492
492
});
493
+
494
+
493
495
it (r'should dispatch exceptions to the exceptionHandler' , (ExceptionHandler e) {
494
496
LoggingExceptionHandler exceptionHandler = e;
495
497
child.on ('myEvent' ).listen ((e) { throw 'bubbleException' ; });
496
498
grandChild.emit (r'myEvent' );
497
499
expect (log.join ('>' )).toEqual ('2>1>0' );
498
500
expect (exceptionHandler.errors[0 ].error).toEqual ('bubbleException' );
499
501
});
502
+
503
+
504
+ it ('should throw "model unstable" error when observer is present' , (RootScope rootScope, NgZone zone, ExceptionHandler e) {
505
+ // Generates a different, equal, list on each evaluation.
506
+ rootScope.context['list' ] = new UnstableList ();
507
+
508
+ rootScope.watch ('list.list' , (n, v) => null , canChangeModel: true );
509
+ try {
510
+ zone.run (() => null );
511
+ } catch (_) {}
512
+
513
+ var errors = (e as LoggingExceptionHandler ).errors;
514
+ expect (errors.length).toEqual (1 );
515
+ expect (errors.first.error, startsWith ('Model did not stabilize' ));
516
+ });
500
517
});
501
518
502
519
it (r'should allow stopping event propagation' , (RootScope rootScope) {
@@ -1601,3 +1618,8 @@ class MockScopeStatsEmitter implements ScopeStatsEmitter {
1601
1618
invoked = true ;
1602
1619
}
1603
1620
}
1621
+
1622
+ class UnstableList {
1623
+ List get list => new List .generate (3 , (i) => i);
1624
+ }
1625
+
0 commit comments