@@ -189,22 +189,26 @@ describe('Scope', function() {
189189 } ) ) ;
190190
191191
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 ;
197200
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+ } ) ;
208212
209213
210214 it ( 'should prevent infinite recursion and print print watcher function name or body' ,
@@ -241,11 +245,11 @@ describe('Scope', function() {
241245 $rootScope . $watch ( 'a' , function ( value ) {
242246 log += '.' ;
243247 expect ( value ) . toBe ( $rootScope . a ) ;
244- } ) ;
248+ } , true ) ;
245249 $rootScope . $watch ( 'b' , function ( value ) {
246250 log += '!' ;
247251 expect ( value ) . toBe ( $rootScope . b ) ;
248- } ) ;
252+ } , true ) ;
249253 $rootScope . $digest ( ) ;
250254 log = '' ;
251255
@@ -331,7 +335,7 @@ describe('Scope', function() {
331335 $rootScope . $watch ( function ( ) { return undefined ; } , logger ) ;
332336 $rootScope . $watch ( function ( ) { return '' ; } , logger ) ;
333337 $rootScope . $watch ( function ( ) { return false ; } , logger ) ;
334- $rootScope . $watch ( function ( ) { return { } ; } , logger ) ;
338+ $rootScope . $watch ( function ( ) { return { } ; } , logger , true ) ;
335339 $rootScope . $watch ( function ( ) { return 23 ; } , logger ) ;
336340
337341 $rootScope . $digest ( ) ;
0 commit comments