diff options
| author | Misko Hevery | 2012-01-12 11:06:10 -0800 |
|---|---|---|
| committer | Misko Hevery | 2012-01-12 13:40:07 -0800 |
| commit | d648d709f3edcac56132e9e2a84a0fc65f5b48ac (patch) | |
| tree | ac0ba5763838a4f4b880dc72f0cbcedc1b7abc05 /test/service/autoScrollSpec.js | |
| parent | 9a8dbfef5151e8e92dc010a597b670e7687ebe9b (diff) | |
| download | angular.js-d648d709f3edcac56132e9e2a84a0fc65f5b48ac.tar.bz2 | |
refactor(module): strict separation between module-config / app-runtime
Diffstat (limited to 'test/service/autoScrollSpec.js')
| -rw-r--r-- | test/service/autoScrollSpec.js | 84 |
1 files changed, 52 insertions, 32 deletions
diff --git a/test/service/autoScrollSpec.js b/test/service/autoScrollSpec.js index 8d04268b..86a47f50 100644 --- a/test/service/autoScrollSpec.js +++ b/test/service/autoScrollSpec.js @@ -53,7 +53,7 @@ describe('$autoScroll', function() { } - beforeEach(inject(function($provide) { + beforeEach(module(function($provide) { elmSpy = {}; $provide.value('$window', { scrollTo: jasmine.createSpy('$window.scrollTo'), @@ -108,11 +108,14 @@ describe('$autoScroll', function() { expectScrollingTo('id=top'))); - it('should not scroll when disabled', inject( - addElements('id=fake', 'a name=fake', 'input name=fake'), - disableScroller(), - changeHashAndScroll('fake'), - expectNoScrolling())); + it('should not scroll when disabled', function() { + module(disableScroller()); + inject( + addElements('id=fake', 'a name=fake', 'input name=fake'), + changeHashAndScroll('fake'), + expectNoScrolling() + ); + }); describe('watcher', function() { @@ -136,40 +139,57 @@ describe('$autoScroll', function() { })); - it('should scroll to element when hash change in hashbang mode', inject( - initLocation({html5Mode: false, historyApi: true}), - addElements('id=some'), - changeHashAndDigest('some'), - expectScrollingTo('id=some'))); + it('should scroll to element when hash change in hashbang mode', function() { + module(initLocation({html5Mode: false, historyApi: true})); + inject( + addElements('id=some'), + changeHashAndDigest('some'), + expectScrollingTo('id=some') + ); + }); - it('should scroll to element when hash change in html5 mode with no history api', inject( - initLocation({html5Mode: true, historyApi: false}), - addElements('id=some'), - changeHashAndDigest('some'), - expectScrollingTo('id=some'))); + it('should scroll to element when hash change in html5 mode with no history api', function() { + module(initLocation({html5Mode: true, historyApi: false})); + inject( + addElements('id=some'), + changeHashAndDigest('some'), + expectScrollingTo('id=some') + ); + }); - it('should not scroll when element does not exist', inject( - initLocation({html5Mode: false, historyApi: false}), - addElements('id=some'), - changeHashAndDigest('other'), - expectNoScrolling())); + it('should not scroll when element does not exist', function() { + module(initLocation({html5Mode: false, historyApi: false})); + inject( + addElements('id=some'), + changeHashAndDigest('other'), + expectNoScrolling() + ); + }); - it('should not scroll when html5 mode with history api', inject( - initLocation({html5Mode: true, historyApi: true}), - addElements('id=some'), - changeHashAndDigest('some'), - expectNoScrolling())); + it('should not scroll when html5 mode with history api', function() { + module(initLocation({html5Mode: true, historyApi: true})); + inject( + addElements('id=some'), + changeHashAndDigest('some'), + expectNoScrolling() + ); + }); - it('should not scroll when disabled', inject( - disableScroller(), - initLocation({html5Mode: false, historyApi: false}), - addElements('id=fake'), - changeHashAndDigest('fake'), - expectNoScrolling())); + it('should not scroll when disabled', function() { + module( + disableScroller(), + initLocation({html5Mode: false, historyApi: false}) + ); + inject( + addElements('id=fake'), + changeHashAndDigest('fake'), + expectNoScrolling() + ); + }); }); }); |
