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

Commit 985d3d7

Browse files
committed
refactor($autoScroll): rename method in test + use $apply instead of $digest
1 parent 249c89c commit 985d3d7

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

test/service/autoScrollSpec.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,11 @@ describe('$autoScroll', function() {
127127
};
128128
}
129129

130-
function changeHashAndDigest(hash) {
130+
function changeHashTo(hash) {
131131
return function ($location, $rootScope, $autoScroll) {
132-
$location.hash(hash);
133-
$rootScope.$digest();
132+
$rootScope.$apply(function() {
133+
$location.hash(hash);
134+
});
134135
};
135136
}
136137

@@ -143,7 +144,7 @@ describe('$autoScroll', function() {
143144
module(initLocation({html5Mode: false, historyApi: true}));
144145
inject(
145146
addElements('id=some'),
146-
changeHashAndDigest('some'),
147+
changeHashTo('some'),
147148
expectScrollingTo('id=some')
148149
);
149150
});
@@ -153,7 +154,7 @@ describe('$autoScroll', function() {
153154
module(initLocation({html5Mode: true, historyApi: false}));
154155
inject(
155156
addElements('id=some'),
156-
changeHashAndDigest('some'),
157+
changeHashTo('some'),
157158
expectScrollingTo('id=some')
158159
);
159160
});
@@ -163,7 +164,7 @@ describe('$autoScroll', function() {
163164
module(initLocation({html5Mode: false, historyApi: false}));
164165
inject(
165166
addElements('id=some'),
166-
changeHashAndDigest('other'),
167+
changeHashTo('other'),
167168
expectNoScrolling()
168169
);
169170
});
@@ -173,7 +174,7 @@ describe('$autoScroll', function() {
173174
module(initLocation({html5Mode: true, historyApi: true}));
174175
inject(
175176
addElements('id=some'),
176-
changeHashAndDigest('some'),
177+
changeHashTo('some'),
177178
expectScrollingTo('id=some')
178179
);
179180
});
@@ -186,7 +187,7 @@ describe('$autoScroll', function() {
186187
);
187188
inject(
188189
addElements('id=fake'),
189-
changeHashAndDigest('fake'),
190+
changeHashTo('fake'),
190191
expectNoScrolling()
191192
);
192193
});

0 commit comments

Comments
 (0)