diff options
| author | Matias Niemelä | 2013-06-18 13:59:57 -0400 |
|---|---|---|
| committer | Misko Hevery | 2013-07-26 23:49:54 -0700 |
| commit | 81923f1e41560327f7de6e8fddfda0d2612658f3 (patch) | |
| tree | bbf8151bddf4d026f8f5fa3196b84a45ecd9c858 /docs/component-spec/annotationsSpec.js | |
| parent | 11521a4cde689c2bd6aaa227b1f45cb3fb53725b (diff) | |
| download | angular.js-81923f1e41560327f7de6e8fddfda0d2612658f3.tar.bz2 | |
feat(ngAnimate): complete rewrite of animations
- ngAnimate directive is gone and was replaced with class based animations/transitions
- support for triggering animations on css class additions and removals
- done callback was added to all animation apis
- $animation and $animator where merged into a single $animate service with api:
- $animate.enter(element, parent, after, done);
- $animate.leave(element, done);
- $animate.move(element, parent, after, done);
- $animate.addClass(element, className, done);
- $animate.removeClass(element, className, done);
BREAKING CHANGE: too many things changed, we'll write up a separate doc with migration instructions
Diffstat (limited to 'docs/component-spec/annotationsSpec.js')
| -rw-r--r-- | docs/component-spec/annotationsSpec.js | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/docs/component-spec/annotationsSpec.js b/docs/component-spec/annotationsSpec.js index 321118ad..a17c906c 100644 --- a/docs/component-spec/annotationsSpec.js +++ b/docs/component-spec/annotationsSpec.js @@ -67,41 +67,33 @@ describe('Docs Annotations', function() { var $scope, parent, element, url, window; beforeEach(function() { - module(function($provide, $animationProvider) { + module(function($provide, $animateProvider) { $provide.value('$window', window = angular.mock.createMockWindow()); - $animationProvider.register('foldout-enter', function($window) { + $animateProvider.register('.foldout', function($window) { return { - start : function(element, done) { + enter : function(element, done) { $window.setTimeout(done, 1000); - } - } - }); - $animationProvider.register('foldout-hide', function($window) { - return { - start : function(element, done) { + }, + show : function(element, done) { $window.setTimeout(done, 500); - } - } - }); - $animationProvider.register('foldout-show', function($window) { - return { - start : function(element, done) { + }, + hide : function(element, done) { $window.setTimeout(done, 200); } } }); }); - inject(function($rootScope, $compile, $templateCache, $rootElement, $animator) { - $animator.enabled(true); + inject(function($rootScope, $compile, $templateCache, $rootElement, $animate) { + $animate.enabled(true); url = '/page.html'; $scope = $rootScope.$new(); parent = angular.element('<div class="parent"></div>'); - element = angular.element('<div data-url="' + url + '" foldout></div>'); //we're injecting the element to the $rootElement since the changes in - //$animator only detect and perform animations if the root element has + //$animate only detect and perform animations if the root element has //animations enabled. If the element is not apart of the DOM //then animations are skipped. + element = angular.element('<div data-url="' + url + '" class="foldout" foldout></div>'); parent.append(element); $rootElement.append(parent); body.append($rootElement); @@ -142,16 +134,19 @@ describe('Docs Annotations', function() { $httpBackend.flush(); window.setTimeout.expect(1).process(); window.setTimeout.expect(1000).process(); + window.setTimeout.expect(0).process(); //hide element.triggerHandler('click'); window.setTimeout.expect(1).process(); - window.setTimeout.expect(500).process(); + window.setTimeout.expect(200).process(); + window.setTimeout.expect(0).process(); //show element.triggerHandler('click'); window.setTimeout.expect(1).process(); - window.setTimeout.expect(200).process(); + window.setTimeout.expect(500).process(); + window.setTimeout.expect(0).process(); })); }); @@ -160,7 +155,7 @@ describe('Docs Annotations', function() { var window, $scope, ctrl; beforeEach(function() { - module(function($provide, $animationProvider) { + module(function($provide, $animateProvider) { $provide.value('$window', window = angular.mock.createMockWindow()); }); inject(function($rootScope, $controller, $location, $cookies, sections) { |
