@@ -218,14 +218,34 @@ describe('Scope', function() {
218
218
} ) ;
219
219
220
220
221
- it ( 'should prevent infinite recursion' , function ( ) {
222
- root . $watch ( 'a' , function ( self , v ) { self . b ++ ; } ) ;
223
- root . $watch ( 'b' , function ( self , v ) { self . a ++ ; } ) ;
221
+ it ( 'should prevent infinite recursion and print watcher expression ' , function ( ) {
222
+ root . $watch ( 'a' , function ( self ) { self . b ++ ; } ) ;
223
+ root . $watch ( 'b' , function ( self ) { self . a ++ ; } ) ;
224
224
root . a = root . b = 0 ;
225
225
226
226
expect ( function ( ) {
227
227
root . $digest ( ) ;
228
- } ) . toThrow ( '100 $digest() iterations reached. Aborting!' ) ;
228
+ } ) . toThrow ( '100 $digest() iterations reached. Aborting!\n' +
229
+ 'Watchers fired in the last 5 iterations: ' +
230
+ '[["a","b"],["a","b"],["a","b"],["a","b"],["a","b"]]' ) ;
231
+ } ) ;
232
+
233
+
234
+ it ( 'should prevent infinite recurcion and print print watcher function name or body' ,
235
+ function ( ) {
236
+ root . $watch ( function watcherA ( ) { return root . a ; } , function ( self ) { self . b ++ ; } ) ;
237
+ root . $watch ( function ( ) { return root . b ; } , function ( self ) { self . a ++ ; } ) ;
238
+ root . a = root . b = 0 ;
239
+
240
+ expect ( function ( ) {
241
+ root . $digest ( ) ;
242
+ } ) . toThrow ( '100 $digest() iterations reached. Aborting!\n' +
243
+ 'Watchers fired in the last 5 iterations: ' +
244
+ '[["fn: watcherA","fn: function () {return root.b;}"],' +
245
+ '["fn: watcherA","fn: function () {return root.b;}"],' +
246
+ '["fn: watcherA","fn: function () {return root.b;}"],' +
247
+ '["fn: watcherA","fn: function () {return root.b;}"],' +
248
+ '["fn: watcherA","fn: function () {return root.b;}"]]' ) ;
229
249
} ) ;
230
250
231
251
0 commit comments