@@ -127,10 +127,11 @@ describe('$autoScroll', function() {
127
127
} ;
128
128
}
129
129
130
- function changeHashAndDigest ( hash ) {
130
+ function changeHashTo ( hash ) {
131
131
return function ( $location , $rootScope , $autoScroll ) {
132
- $location . hash ( hash ) ;
133
- $rootScope . $digest ( ) ;
132
+ $rootScope . $apply ( function ( ) {
133
+ $location . hash ( hash ) ;
134
+ } ) ;
134
135
} ;
135
136
}
136
137
@@ -143,7 +144,7 @@ describe('$autoScroll', function() {
143
144
module ( initLocation ( { html5Mode : false , historyApi : true } ) ) ;
144
145
inject (
145
146
addElements ( 'id=some' ) ,
146
- changeHashAndDigest ( 'some' ) ,
147
+ changeHashTo ( 'some' ) ,
147
148
expectScrollingTo ( 'id=some' )
148
149
) ;
149
150
} ) ;
@@ -153,7 +154,7 @@ describe('$autoScroll', function() {
153
154
module ( initLocation ( { html5Mode : true , historyApi : false } ) ) ;
154
155
inject (
155
156
addElements ( 'id=some' ) ,
156
- changeHashAndDigest ( 'some' ) ,
157
+ changeHashTo ( 'some' ) ,
157
158
expectScrollingTo ( 'id=some' )
158
159
) ;
159
160
} ) ;
@@ -163,7 +164,7 @@ describe('$autoScroll', function() {
163
164
module ( initLocation ( { html5Mode : false , historyApi : false } ) ) ;
164
165
inject (
165
166
addElements ( 'id=some' ) ,
166
- changeHashAndDigest ( 'other' ) ,
167
+ changeHashTo ( 'other' ) ,
167
168
expectNoScrolling ( )
168
169
) ;
169
170
} ) ;
@@ -173,7 +174,7 @@ describe('$autoScroll', function() {
173
174
module ( initLocation ( { html5Mode : true , historyApi : true } ) ) ;
174
175
inject (
175
176
addElements ( 'id=some' ) ,
176
- changeHashAndDigest ( 'some' ) ,
177
+ changeHashTo ( 'some' ) ,
177
178
expectScrollingTo ( 'id=some' )
178
179
) ;
179
180
} ) ;
@@ -186,7 +187,7 @@ describe('$autoScroll', function() {
186
187
) ;
187
188
inject (
188
189
addElements ( 'id=fake' ) ,
189
- changeHashAndDigest ( 'fake' ) ,
190
+ changeHashTo ( 'fake' ) ,
190
191
expectNoScrolling ( )
191
192
) ;
192
193
} ) ;
0 commit comments