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
2013-06-18 17:59:57 +00:00
|
|
|
describe("$animate", function() {
|
|
|
|
|
|
|
|
|
|
describe("without animation", function() {
|
2013-08-02 02:17:10 +00:00
|
|
|
beforeEach(module(function() {
|
|
|
|
|
return function($compile, _$rootElement_, $rootScope) {
|
|
|
|
|
element = $compile('<div></div>')($rootScope);
|
|
|
|
|
$rootElement = _$rootElement_;
|
|
|
|
|
};
|
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
2013-06-18 17:59:57 +00:00
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
it("should add element at the start of enter animation", inject(function($animate, $compile, $rootScope) {
|
|
|
|
|
var child = $compile('<div></div>')($rootScope);
|
|
|
|
|
expect(element.contents().length).toBe(0);
|
|
|
|
|
$animate.enter(child, element);
|
|
|
|
|
expect(element.contents().length).toBe(1);
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
it("should remove the element at the end of leave animation", inject(function($animate, $compile, $rootScope) {
|
|
|
|
|
var child = $compile('<div></div>')($rootScope);
|
|
|
|
|
element.append(child);
|
|
|
|
|
expect(element.contents().length).toBe(1);
|
|
|
|
|
$animate.leave(child);
|
|
|
|
|
expect(element.contents().length).toBe(0);
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
it("should reorder the move animation", inject(function($animate, $compile, $rootScope) {
|
|
|
|
|
var child1 = $compile('<div>1</div>')($rootScope);
|
|
|
|
|
var child2 = $compile('<div>2</div>')($rootScope);
|
|
|
|
|
element.append(child1);
|
|
|
|
|
element.append(child2);
|
|
|
|
|
expect(element.text()).toBe('12');
|
|
|
|
|
$animate.move(child1, element, child2);
|
|
|
|
|
expect(element.text()).toBe('21');
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
it("should still perform DOM operations even if animations are disabled", inject(function($animate) {
|
|
|
|
|
$animate.enabled(false);
|
|
|
|
|
expect(element).toBeShown();
|
2013-07-24 03:02:15 +00:00
|
|
|
$animate.addClass(element, 'ng-hide');
|
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
2013-06-18 17:59:57 +00:00
|
|
|
expect(element).toBeHidden();
|
|
|
|
|
}));
|
2013-08-02 02:17:10 +00:00
|
|
|
|
2013-09-24 00:29:51 +00:00
|
|
|
it("should add and remove classes on SVG elements", inject(function($animate) {
|
|
|
|
|
if (!window.SVGElement) return;
|
|
|
|
|
var svg = jqLite('<svg><rect></rect></svg>');
|
|
|
|
|
var rect = svg.children();
|
|
|
|
|
$animate.enabled(false);
|
|
|
|
|
expect(rect).toBeShown();
|
|
|
|
|
$animate.addClass(rect, 'ng-hide');
|
|
|
|
|
expect(rect).toBeHidden();
|
|
|
|
|
$animate.removeClass(rect, 'ng-hide');
|
|
|
|
|
expect(rect).not.toBeHidden();
|
|
|
|
|
}));
|
|
|
|
|
|
2013-08-02 02:17:10 +00:00
|
|
|
it("should throw error on wrong selector", function() {
|
|
|
|
|
module(function($animateProvider) {
|
|
|
|
|
expect(function() {
|
|
|
|
|
$animateProvider.register('abc', null);
|
2013-08-13 22:30:52 +00:00
|
|
|
}).toThrowMinErr("$animate", "notcsel", "Expecting class selector starting with '.' got 'abc'.");
|
2013-08-02 02:17:10 +00:00
|
|
|
});
|
|
|
|
|
inject();
|
|
|
|
|
});
|
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
2013-06-18 17:59:57 +00:00
|
|
|
});
|
|
|
|
|
});
|