@@ -189,22 +189,26 @@ describe('Scope', function() {
189
189
} ) ) ;
190
190
191
191
192
- it ( 'should prevent infinite recursion and print watcher expression' , inject (
193
- function ( $rootScope ) {
194
- $rootScope . $watch ( 'a' , function ( ) { $rootScope . b ++ ; } ) ;
195
- $rootScope . $watch ( 'b' , function ( ) { $rootScope . a ++ ; } ) ;
196
- $rootScope . a = $rootScope . b = 0 ;
192
+ it ( 'should prevent infinite recursion and print watcher expression' , function ( ) {
193
+ module ( function ( $rootScopeProvider ) {
194
+ $rootScopeProvider . ttl ( 100 ) ;
195
+ } ) ;
196
+ inject ( function ( $rootScope ) {
197
+ $rootScope . $watch ( 'a' , function ( ) { $rootScope . b ++ ; } ) ;
198
+ $rootScope . $watch ( 'b' , function ( ) { $rootScope . a ++ ; } ) ;
199
+ $rootScope . a = $rootScope . b = 0 ;
197
200
198
- expect ( function ( ) {
199
- $rootScope . $digest ( ) ;
200
- } ) . toThrow ( '100 $digest() iterations reached. Aborting!\n' +
201
- 'Watchers fired in the last 5 iterations: ' +
202
- '[["a; newVal: 96; oldVal: 95","b; newVal: 97; oldVal: 96"],' +
203
- '["a; newVal: 97; oldVal: 96","b; newVal: 98; oldVal: 97"],' +
204
- '["a; newVal: 98; oldVal: 97","b; newVal: 99; oldVal: 98"],' +
205
- '["a; newVal: 99; oldVal: 98","b; newVal: 100; oldVal: 99"],' +
206
- '["a; newVal: 100; oldVal: 99","b; newVal: 101; oldVal: 100"]]' ) ;
207
- } ) ) ;
201
+ expect ( function ( ) {
202
+ $rootScope . $digest ( ) ;
203
+ } ) . toThrow ( '100 $digest() iterations reached. Aborting!\n' +
204
+ 'Watchers fired in the last 5 iterations: ' +
205
+ '[["a; newVal: 96; oldVal: 95","b; newVal: 97; oldVal: 96"],' +
206
+ '["a; newVal: 97; oldVal: 96","b; newVal: 98; oldVal: 97"],' +
207
+ '["a; newVal: 98; oldVal: 97","b; newVal: 99; oldVal: 98"],' +
208
+ '["a; newVal: 99; oldVal: 98","b; newVal: 100; oldVal: 99"],' +
209
+ '["a; newVal: 100; oldVal: 99","b; newVal: 101; oldVal: 100"]]' ) ;
210
+ } ) ;
211
+ } ) ;
208
212
209
213
210
214
it ( 'should prevent infinite recursion and print print watcher function name or body' ,
@@ -241,11 +245,11 @@ describe('Scope', function() {
241
245
$rootScope . $watch ( 'a' , function ( value ) {
242
246
log += '.' ;
243
247
expect ( value ) . toBe ( $rootScope . a ) ;
244
- } ) ;
248
+ } , true ) ;
245
249
$rootScope . $watch ( 'b' , function ( value ) {
246
250
log += '!' ;
247
251
expect ( value ) . toBe ( $rootScope . b ) ;
248
- } ) ;
252
+ } , true ) ;
249
253
$rootScope . $digest ( ) ;
250
254
log = '' ;
251
255
@@ -331,7 +335,7 @@ describe('Scope', function() {
331
335
$rootScope . $watch ( function ( ) { return undefined ; } , logger ) ;
332
336
$rootScope . $watch ( function ( ) { return '' ; } , logger ) ;
333
337
$rootScope . $watch ( function ( ) { return false ; } , logger ) ;
334
- $rootScope . $watch ( function ( ) { return { } ; } , logger ) ;
338
+ $rootScope . $watch ( function ( ) { return { } ; } , logger , true ) ;
335
339
$rootScope . $watch ( function ( ) { return 23 ; } , logger ) ;
336
340
337
341
$rootScope . $digest ( ) ;
0 commit comments