diff options
| author | Misko Hevery | 2011-08-10 13:15:43 -0700 |
|---|---|---|
| committer | Misko Hevery | 2011-08-12 15:47:47 -0700 |
| commit | 42062dab34192d2cb9ed66a720c0f791408c61c0 (patch) | |
| tree | ca85b56f12dd0138dbe3d7f1346c4125d64e09a5 /test/service/updateViewSpec.js | |
| parent | 1c9fc1e1dec67c8c05f02da1e0853439238c4d8e (diff) | |
| download | angular.js-42062dab34192d2cb9ed66a720c0f791408c61c0.tar.bz2 | |
refactor(scope): remove $flush/$observe ng:eval/ng:eval-order
Diffstat (limited to 'test/service/updateViewSpec.js')
| -rw-r--r-- | test/service/updateViewSpec.js | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/test/service/updateViewSpec.js b/test/service/updateViewSpec.js deleted file mode 100644 index d8932d29..00000000 --- a/test/service/updateViewSpec.js +++ /dev/null @@ -1,63 +0,0 @@ -'use strict'; - -describe('$updateView', function() { - var scope, browser, evalCount, $updateView; - - beforeEach(function(){ - browser = new MockBrowser(); - // Pretend that you are real Browser so that we see the delays - browser.isMock = false; - browser.defer = jasmine.createSpy('defer'); - - scope = angular.scope(null, {$browser:browser}); - $updateView = scope.$service('$updateView'); - scope.$observe(function(){ evalCount++; }); - evalCount = 0; - }); - - - afterEach(function(){ - dealoc(scope); - }); - - - it('should eval root scope after a delay', function(){ - $updateView(); - expect(evalCount).toEqual(0); - expect(browser.defer).toHaveBeenCalled(); - expect(browser.defer.mostRecentCall.args[1]).toEqual(25); - browser.defer.mostRecentCall.args[0](); - expect(evalCount).toEqual(1); - }); - - - it('should allow changing of delay time', function(){ - var oldValue = angular.service('$updateView').delay; - angular.service('$updateView').delay = 50; - $updateView(); - expect(evalCount).toEqual(0); - expect(browser.defer).toHaveBeenCalled(); - expect(browser.defer.mostRecentCall.args[1]).toEqual(50); - angular.service('$updateView').delay = oldValue; - }); - - - it('should ignore multiple requests for update', function(){ - $updateView(); - $updateView(); - expect(evalCount).toEqual(0); - expect(browser.defer).toHaveBeenCalled(); - expect(browser.defer.callCount).toEqual(1); - browser.defer.mostRecentCall.args[0](); - expect(evalCount).toEqual(1); - }); - - - it('should update immediatelly in test/mock mode', function(){ - scope = angular.scope(); - scope.$observe(function(){ evalCount++; }); - expect(evalCount).toEqual(0); - scope.$service('$updateView')(); - expect(evalCount).toEqual(1); - }); -}); |
