@@ -122,7 +122,7 @@ describe('$anchorScroll', function() {
122
122
return spyOnJQLiteDocumentComplete ( function ( callback ) { callback ( ) ; } ) ;
123
123
}
124
124
125
- function simulateWindowLoadEvent ( ) {
125
+ function fireWindowLoadEvent ( ) {
126
126
return function ( $browser ) {
127
127
var callback = window . jqLiteDocumentComplete . mostRecentCall . args [ 0 ] ;
128
128
callback ( ) ;
@@ -190,12 +190,6 @@ describe('$anchorScroll', function() {
190
190
191
191
describe ( 'watcher' , function ( ) {
192
192
193
- function initAnchorScroll ( ) {
194
- return function ( $rootScope , $anchorScroll ) {
195
- $rootScope . $digest ( ) ;
196
- } ;
197
- }
198
-
199
193
function initLocation ( config ) {
200
194
return function ( $provide , $locationProvider ) {
201
195
$provide . value ( '$sniffer' , { history : config . historyApi } ) ;
@@ -220,7 +214,6 @@ describe('$anchorScroll', function() {
220
214
it ( 'should scroll to element when hash change in hashbang mode' , function ( ) {
221
215
module ( initLocation ( { html5Mode : false , historyApi : true } ) ) ;
222
216
inject (
223
- initAnchorScroll ( ) ,
224
217
addElements ( 'id=some' ) ,
225
218
changeHashTo ( 'some' ) ,
226
219
expectScrollingTo ( 'id=some' )
@@ -231,7 +224,6 @@ describe('$anchorScroll', function() {
231
224
it ( 'should scroll to element when hash change in html5 mode with no history api' , function ( ) {
232
225
module ( initLocation ( { html5Mode : true , historyApi : false } ) ) ;
233
226
inject (
234
- initAnchorScroll ( ) ,
235
227
addElements ( 'id=some' ) ,
236
228
changeHashTo ( 'some' ) ,
237
229
expectScrollingTo ( 'id=some' )
@@ -241,15 +233,13 @@ describe('$anchorScroll', function() {
241
233
242
234
it ( 'should not scroll to the top if $anchorScroll is initializing and location hash is empty' ,
243
235
inject (
244
- initAnchorScroll ( ) ,
245
236
expectNoScrolling ( ) )
246
237
) ;
247
238
248
239
249
240
it ( 'should not scroll when element does not exist' , function ( ) {
250
241
module ( initLocation ( { html5Mode : false , historyApi : false } ) ) ;
251
242
inject (
252
- initAnchorScroll ( ) ,
253
243
addElements ( 'id=some' ) ,
254
244
changeHashTo ( 'other' ) ,
255
245
expectNoScrolling ( )
@@ -260,7 +250,6 @@ describe('$anchorScroll', function() {
260
250
it ( 'should scroll when html5 mode with history api' , function ( ) {
261
251
module ( initLocation ( { html5Mode : true , historyApi : true } ) ) ;
262
252
inject (
263
- initAnchorScroll ( ) ,
264
253
addElements ( 'id=some' ) ,
265
254
changeHashTo ( 'some' ) ,
266
255
expectScrollingTo ( 'id=some' )
@@ -302,11 +291,10 @@ describe('$anchorScroll', function() {
302
291
afterEach ( unspyOnJQLiteDocumentComplete ( ) ) ;
303
292
304
293
it ( 'should wait for the document to be completely loaded before auto-scrolling' , inject (
305
- initAnchorScroll ( ) ,
306
294
addElements ( 'id=some' ) ,
307
295
changeHashTo ( 'some' ) ,
308
296
expectNoScrolling ( 'id=some' ) ,
309
- simulateWindowLoadEvent ( ) ,
297
+ fireWindowLoadEvent ( ) ,
310
298
expectScrollingTo ( 'id=some' )
311
299
) ) ;
312
300
0 commit comments