Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit c7ed560

Browse files
squash
1 parent 2940314 commit c7ed560

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

test/ng/anchorScrollSpec.js

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ describe('$anchorScroll', function() {
122122
return spyOnJQLiteDocumentComplete(function(callback) { callback(); });
123123
}
124124

125-
function simulateWindowLoadEvent() {
125+
function fireWindowLoadEvent() {
126126
return function($browser) {
127127
var callback = window.jqLiteDocumentComplete.mostRecentCall.args[0];
128128
callback();
@@ -190,12 +190,6 @@ describe('$anchorScroll', function() {
190190

191191
describe('watcher', function() {
192192

193-
function initAnchorScroll() {
194-
return function($rootScope, $anchorScroll) {
195-
$rootScope.$digest();
196-
};
197-
}
198-
199193
function initLocation(config) {
200194
return function($provide, $locationProvider) {
201195
$provide.value('$sniffer', {history: config.historyApi});
@@ -220,7 +214,6 @@ describe('$anchorScroll', function() {
220214
it('should scroll to element when hash change in hashbang mode', function() {
221215
module(initLocation({html5Mode: false, historyApi: true}));
222216
inject(
223-
initAnchorScroll(),
224217
addElements('id=some'),
225218
changeHashTo('some'),
226219
expectScrollingTo('id=some')
@@ -231,7 +224,6 @@ describe('$anchorScroll', function() {
231224
it('should scroll to element when hash change in html5 mode with no history api', function() {
232225
module(initLocation({html5Mode: true, historyApi: false}));
233226
inject(
234-
initAnchorScroll(),
235227
addElements('id=some'),
236228
changeHashTo('some'),
237229
expectScrollingTo('id=some')
@@ -241,15 +233,13 @@ describe('$anchorScroll', function() {
241233

242234
it('should not scroll to the top if $anchorScroll is initializing and location hash is empty',
243235
inject(
244-
initAnchorScroll(),
245236
expectNoScrolling())
246237
);
247238

248239

249240
it('should not scroll when element does not exist', function() {
250241
module(initLocation({html5Mode: false, historyApi: false}));
251242
inject(
252-
initAnchorScroll(),
253243
addElements('id=some'),
254244
changeHashTo('other'),
255245
expectNoScrolling()
@@ -260,7 +250,6 @@ describe('$anchorScroll', function() {
260250
it('should scroll when html5 mode with history api', function() {
261251
module(initLocation({html5Mode: true, historyApi: true}));
262252
inject(
263-
initAnchorScroll(),
264253
addElements('id=some'),
265254
changeHashTo('some'),
266255
expectScrollingTo('id=some')
@@ -302,11 +291,10 @@ describe('$anchorScroll', function() {
302291
afterEach(unspyOnJQLiteDocumentComplete());
303292

304293
it('should wait for the document to be completely loaded before auto-scrolling', inject(
305-
initAnchorScroll(),
306294
addElements('id=some'),
307295
changeHashTo('some'),
308296
expectNoScrolling('id=some'),
309-
simulateWindowLoadEvent(),
297+
fireWindowLoadEvent(),
310298
expectScrollingTo('id=some')
311299
));
312300

0 commit comments

Comments
 (0)