diff options
| -rw-r--r-- | test/service/autoScrollSpec.js | 17 |
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() ); }); |
