File tree 1 file changed +22
-0
lines changed
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,28 @@ describe('$interpolate', function() {
125
125
126
126
expect ( $rootScope . $countWatchers ( ) ) . toBe ( 0 ) ;
127
127
} ) ) ;
128
+
129
+ it ( 'should stop watching strings with no expressions after first execution' ,
130
+ inject ( function ( $interpolate , $rootScope ) {
131
+ var spy = jasmine . createSpy ( ) ;
132
+ $rootScope . $watch ( $interpolate ( 'foo' ) , spy ) ;
133
+ $rootScope . $digest ( ) ;
134
+ expect ( $rootScope . $countWatchers ( ) ) . toBe ( 0 ) ;
135
+ expect ( spy ) . toHaveBeenCalledWith ( 'foo' , 'foo' , $rootScope ) ;
136
+ expect ( spy . calls . length ) . toBe ( 1 ) ;
137
+ } )
138
+ ) ;
139
+
140
+ it ( 'should stop watching strings with only constant expressions after first execution' ,
141
+ inject ( function ( $interpolate , $rootScope ) {
142
+ var spy = jasmine . createSpy ( ) ;
143
+ $rootScope . $watch ( $interpolate ( 'foo {{42}}' ) , spy ) ;
144
+ $rootScope . $digest ( ) ;
145
+ expect ( $rootScope . $countWatchers ( ) ) . toBe ( 0 ) ;
146
+ expect ( spy ) . toHaveBeenCalledWith ( 'foo 42' , 'foo 42' , $rootScope ) ;
147
+ expect ( spy . calls . length ) . toBe ( 1 ) ;
148
+ } )
149
+ ) ;
128
150
} ) ;
129
151
130
152
describe ( 'interpolation escaping' , function ( ) {
You can’t perform that action at this time.
0 commit comments