diff options
| author | Matias Niemelàˆ | 2013-07-22 15:37:45 -0400 |
|---|---|---|
| committer | Misko Hevery | 2013-07-26 23:49:54 -0700 |
| commit | 15389b0e377e2a84b85178e993e4940d8098d0ed (patch) | |
| tree | 06054bded1c252ca0d2c62b1a47267fee4c1eb98 /docs/component-spec/annotationsSpec.js | |
| parent | 7d69d52acff8578e0f7d6fe57a6c45561a05b182 (diff) | |
| download | angular.js-15389b0e377e2a84b85178e993e4940d8098d0ed.tar.bz2 | |
fix(ngAnimate): $timeout integration and cancel callbacks added
Diffstat (limited to 'docs/component-spec/annotationsSpec.js')
| -rw-r--r-- | docs/component-spec/annotationsSpec.js | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/docs/component-spec/annotationsSpec.js b/docs/component-spec/annotationsSpec.js index 90c72918..7dd5b696 100644 --- a/docs/component-spec/annotationsSpec.js +++ b/docs/component-spec/annotationsSpec.js @@ -69,16 +69,16 @@ describe('Docs Annotations', function() { beforeEach(function() { module(function($provide, $animateProvider) { $provide.value('$window', window = angular.mock.createMockWindow()); - $animateProvider.register('.foldout', function($window) { + $animateProvider.register('.foldout', function($timeout) { return { enter : function(element, done) { - $window.setTimeout(done, 1000); + $timeout(done, 1000); }, removeClass : function(element, className, done) { - $window.setTimeout(done, 500); + $timeout(done, 500); }, addClass : function(element, className, done) { - $window.setTimeout(done, 200); + $timeout(done, 200); } } }); @@ -112,41 +112,46 @@ describe('Docs Annotations', function() { expect(foldout.html()).toContain('loading'); })); - it('should download a foldout HTML page and animate the contents', inject(function($httpBackend) { + it('should download a foldout HTML page and animate the contents', inject(function($httpBackend, $timeout) { $httpBackend.expect('GET', url).respond('hello'); element.triggerHandler('click'); $httpBackend.flush(); - window.setTimeout.expect(1).process(); - window.setTimeout.expect(1000).process(); + $timeout.flushNext(0); + $timeout.flushNext(1); + $timeout.flushNext(0); + $timeout.flushNext(1000); var kids = body.children(); var foldout = angular.element(kids[kids.length-1]); expect(foldout.text()).toContain('hello'); })); - it('should hide then show when clicked again', inject(function($httpBackend) { + it('should hide then show when clicked again', inject(function($httpBackend, $timeout) { $httpBackend.expect('GET', url).respond('hello'); //enter element.triggerHandler('click'); $httpBackend.flush(); - window.setTimeout.expect(1).process(); - window.setTimeout.expect(1000).process(); - window.setTimeout.expect(0).process(); + $timeout.flushNext(0); + $timeout.flushNext(1); + $timeout.flushNext(0); + $timeout.flushNext(1000); //hide element.triggerHandler('click'); - window.setTimeout.expect(1).process(); - window.setTimeout.expect(200).process(); - window.setTimeout.expect(0).process(); + $timeout.flushNext(1); + $timeout.flushNext(0); + $timeout.flushNext(200); + $timeout.flushNext(0); //show element.triggerHandler('click'); - window.setTimeout.expect(1).process(); - window.setTimeout.expect(500).process(); - window.setTimeout.expect(0).process(); + $timeout.flushNext(1); + $timeout.flushNext(0); + $timeout.flushNext(500); + $timeout.flushNext(0); })); }); |
