aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVojta Jina2012-01-12 02:31:15 -0800
committerVojta Jina2012-01-13 01:05:24 -0800
commit985d3d75586a16020d78564753f9b46ec9091929 (patch)
tree49ff03db90982ea3eb79d8301a510b26f70ba36f
parent249c89c0911254873c68cd753d903ea5606344ac (diff)
downloadangular.js-985d3d75586a16020d78564753f9b46ec9091929.tar.bz2
refactor($autoScroll): rename method in test + use $apply instead of $digest
-rw-r--r--test/service/autoScrollSpec.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/test/service/autoScrollSpec.js b/test/service/autoScrollSpec.js
index 4f4dd0e2..72fc3424 100644
--- a/test/service/autoScrollSpec.js
+++ b/test/service/autoScrollSpec.js
@@ -127,10 +127,11 @@ describe('$autoScroll', function() {
};
}
- function changeHashAndDigest(hash) {
+ function changeHashTo(hash) {
return function ($location, $rootScope, $autoScroll) {
- $location.hash(hash);
- $rootScope.$digest();
+ $rootScope.$apply(function() {
+ $location.hash(hash);
+ });
};
}
@@ -143,7 +144,7 @@ describe('$autoScroll', function() {
module(initLocation({html5Mode: false, historyApi: true}));
inject(
addElements('id=some'),
- changeHashAndDigest('some'),
+ changeHashTo('some'),
expectScrollingTo('id=some')
);
});
@@ -153,7 +154,7 @@ describe('$autoScroll', function() {
module(initLocation({html5Mode: true, historyApi: false}));
inject(
addElements('id=some'),
- changeHashAndDigest('some'),
+ changeHashTo('some'),
expectScrollingTo('id=some')
);
});
@@ -163,7 +164,7 @@ describe('$autoScroll', function() {
module(initLocation({html5Mode: false, historyApi: false}));
inject(
addElements('id=some'),
- changeHashAndDigest('other'),
+ changeHashTo('other'),
expectNoScrolling()
);
});
@@ -173,7 +174,7 @@ describe('$autoScroll', function() {
module(initLocation({html5Mode: true, historyApi: true}));
inject(
addElements('id=some'),
- changeHashAndDigest('some'),
+ changeHashTo('some'),
expectScrollingTo('id=some')
);
});
@@ -186,7 +187,7 @@ describe('$autoScroll', function() {
);
inject(
addElements('id=fake'),
- changeHashAndDigest('fake'),
+ changeHashTo('fake'),
expectNoScrolling()
);
});