aboutsummaryrefslogtreecommitdiffstats
path: root/test/ngAnimate/animateSpec.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/ngAnimate/animateSpec.js')
-rw-r--r--test/ngAnimate/animateSpec.js84
1 files changed, 40 insertions, 44 deletions
diff --git a/test/ngAnimate/animateSpec.js b/test/ngAnimate/animateSpec.js
index 52bf5e0b..e069049f 100644
--- a/test/ngAnimate/animateSpec.js
+++ b/test/ngAnimate/animateSpec.js
@@ -81,8 +81,6 @@ describe("ngAnimate", function() {
}
}
return {
- show : animate,
- hide : animate,
leave : animate,
addClass : animate,
removeClass : animate
@@ -97,8 +95,6 @@ describe("ngAnimate", function() {
}
}
return {
- show : animate,
- hide : animate,
leave : animate,
addClass : animate,
removeClass : animate
@@ -106,7 +102,7 @@ describe("ngAnimate", function() {
});
$animateProvider.register('.setup-memo', function() {
return {
- show: function(element, done) {
+ removeClass: function(element, className, done) {
element.text('memento');
done();
}
@@ -160,7 +156,7 @@ describe("ngAnimate", function() {
$rootScope.$digest();
element.addClass('ng-hide');
expect(element).toBeHidden();
- $animate.show(element);
+ $animate.removeClass(element, 'ng-hide');
if($sniffer.transitions) {
expect(element.hasClass('ng-hide-remove')).toBe(true);
window.setTimeout.expect(1).process();
@@ -173,7 +169,7 @@ describe("ngAnimate", function() {
it("should animate the hide animation event", inject(function($animate, $rootScope, $sniffer) {
$rootScope.$digest();
expect(element).toBeShown();
- $animate.hide(element);
+ $animate.addClass(element, 'ng-hide');
if($sniffer.transitions) {
expect(element.hasClass('ng-hide-add')).toBe(true);
window.setTimeout.expect(1).process();
@@ -206,14 +202,14 @@ describe("ngAnimate", function() {
window.setTimeout.expect(0).process();
//hide
- $animate.hide(child);
+ $animate.addClass(child, 'ng-hide');
expect(child.attr('class')).toContain('ng-hide-add');
window.setTimeout.expect(1).process();
expect(child.attr('class')).toContain('ng-hide-add-active');
window.setTimeout.expect(0).process();
//show
- $animate.show(child);
+ $animate.removeClass(child, 'ng-hide');
expect(child.attr('class')).toContain('ng-hide-remove');
window.setTimeout.expect(1).process();
expect(child.attr('class')).toContain('ng-hide-remove-active');
@@ -236,12 +232,12 @@ describe("ngAnimate", function() {
element.text('123');
expect(element.text()).toBe('123');
- $animate.show(element);
+ $animate.removeClass(element, 'ng-hide');
expect(element.text()).toBe('123');
$animate.enabled(true);
- $animate.show(element);
+ $animate.removeClass(element, 'ng-hide');
if($sniffer.transitions) {
window.setTimeout.expect(1).process();
window.setTimeout.expect(0).process();
@@ -256,7 +252,7 @@ describe("ngAnimate", function() {
child.addClass('custom-delay');
expect(element).toBeShown();
- $animate.hide(child);
+ $animate.addClass(child, 'ng-hide');
if($sniffer.transitions) {
window.setTimeout.expect(1).process();
}
@@ -293,12 +289,12 @@ describe("ngAnimate", function() {
element.append(child);
child.addClass('custom-delay ng-hide');
- $animate.show(child);
+ $animate.removeClass(child, 'ng-hide');
if($sniffer.transitions) {
window.setTimeout.expect(1).process();
}
- $animate.hide(child);
+ $animate.addClass(child, 'ng-hide');
expect(child.hasClass('animation-cancelled')).toBe(true);
}));
@@ -310,12 +306,12 @@ describe("ngAnimate", function() {
child.css('display','none');
element.data('foo', 'bar');
- $animate.show(element);
+ $animate.removeClass(element, 'ng-hide');
if($sniffer.transitions) {
window.setTimeout.expect(1).process();
}
- $animate.hide(element);
+ $animate.addClass(element, 'ng-hide');
expect(element.data('foo')).toEqual('bar');
}));
@@ -357,7 +353,7 @@ describe("ngAnimate", function() {
element.addClass('custom-delay custom-long-delay');
$rootScope.$digest();
- $animate.show(element);
+ $animate.removeClass(element, 'ng-hide');
if($sniffer.transitions) {
window.setTimeout.expect(1).process();
@@ -401,7 +397,7 @@ describe("ngAnimate", function() {
element.addClass('ng-hide');
expect(element).toBeHidden();
- $animate.show(element);
+ $animate.removeClass(element, 'ng-hide');
if ($sniffer.animations) {
window.setTimeout.expect(1).process();
window.setTimeout.expect(4000).process();
@@ -423,7 +419,7 @@ describe("ngAnimate", function() {
element.addClass('ng-hide');
expect(element).toBeHidden();
- $animate.show(element);
+ $animate.removeClass(element, 'ng-hide');
if ($sniffer.animations) {
window.setTimeout.expect(1).process();
window.setTimeout.expect(6000).process();
@@ -445,7 +441,7 @@ describe("ngAnimate", function() {
element.addClass('ng-hide');
expect(element).toBeHidden();
- $animate.show(element);
+ $animate.removeClass(element, 'ng-hide');
if ($sniffer.animations) {
window.setTimeout.expect(1).process();
window.setTimeout.expect(2000).process();
@@ -469,7 +465,7 @@ describe("ngAnimate", function() {
element.addClass('ng-hide');
expect(element).toBeHidden();
- $animate.show(element);
+ $animate.removeClass(element, 'ng-hide');
if ($sniffer.transitions) {
window.setTimeout.expect(1).process();
window.setTimeout.expect(20000).process();
@@ -489,7 +485,7 @@ describe("ngAnimate", function() {
element = $compile(html('<div style="' + style + '">1</div>'))($rootScope);
element.addClass('ng-hide');
expect(element).toBeHidden();
- $animate.show(element);
+ $animate.removeClass(element, 'ng-hide');
expect(element).toBeShown();
}));
@@ -501,7 +497,7 @@ describe("ngAnimate", function() {
element = $compile(html('<div style="' + style + '">1</div>'))($rootScope);
element.addClass('custom');
- $animate.show(element);
+ $animate.removeClass(element, 'ng-hide');
if($sniffer.animations) {
window.setTimeout.expect(1).process();
expect(element.hasClass('ng-hide-remove')).toBe(true);
@@ -511,7 +507,7 @@ describe("ngAnimate", function() {
expect(window.setTimeout.queue.length).toBe(0);
}
- $animate.hide(element);
+ $animate.addClass(element, 'ng-hide');
expect(element.hasClass('ng-hide-remove')).toBe(false); //added right away
if($sniffer.animations) { //cleanup some pending animations
@@ -533,7 +529,7 @@ describe("ngAnimate", function() {
element.addClass('ng-hide');
expect(element).toBeHidden();
- $animate.show(element);
+ $animate.removeClass(element, 'ng-hide');
expect(element).toBeShown();
$animate.enabled(true);
@@ -541,7 +537,7 @@ describe("ngAnimate", function() {
element.addClass('ng-hide');
expect(element).toBeHidden();
- $animate.show(element);
+ $animate.removeClass(element, 'ng-hide');
if ($sniffer.transitions) {
window.setTimeout.expect(1).process();
window.setTimeout.expect(1000).process();
@@ -556,7 +552,7 @@ describe("ngAnimate", function() {
inject(function($animate, $rootScope, $compile, $sniffer) {
element = $compile(html('<div style="' + vendorPrefix + 'transition-duration: 1s, 2000ms, 1s; ' + vendorPrefix + 'transition-property: height, left, opacity">foo</div>'))($rootScope);
element.addClass('ng-hide');
- $animate.show(element);
+ $animate.removeClass(element, 'ng-hide');
if ($sniffer.transitions) {
expect(element).toBeHidden();
window.setTimeout.expect(1).process();
@@ -577,7 +573,7 @@ describe("ngAnimate", function() {
'transition-property: height, left, opacity">foo</div>'))($rootScope);
element.addClass('ng-hide');
- $animate.show(element);
+ $animate.removeClass(element, 'ng-hide');
expect(element).toBeShown();
$animate.enabled(true);
@@ -585,7 +581,7 @@ describe("ngAnimate", function() {
element.addClass('ng-hide');
expect(element).toBeHidden();
- $animate.show(element);
+ $animate.removeClass(element, 'ng-hide');
if ($sniffer.transitions) {
window.setTimeout.expect(1).process();
window.setTimeout.expect(3000).process();
@@ -608,7 +604,7 @@ describe("ngAnimate", function() {
element.addClass('ng-hide');
expect(element).toBeHidden();
- $animate.show(element);
+ $animate.removeClass(element, 'ng-hide');
if ($sniffer.transitions) {
window.setTimeout.expect(1).process();
window.setTimeout.expect(11000).process();
@@ -627,7 +623,7 @@ describe("ngAnimate", function() {
element = $compile(html('<div style="' + style + '">1</div>'))($rootScope);
element.addClass('ng-hide');
- $animate.show(element);
+ $animate.removeClass(element, 'ng-hide');
if($sniffer.transitions) {
expect(element.hasClass('ng-hide-remove')).toBe(true);
window.setTimeout.expect(1).process();
@@ -641,7 +637,7 @@ describe("ngAnimate", function() {
expect(element.hasClass('ng-hide-remove-active')).toBe(false);
expect(element).toBeShown();
- $animate.hide(element);
+ $animate.addClass(element, 'ng-hide');
if($sniffer.transitions) {
expect(element.hasClass('ng-hide-add')).toBe(true);
window.setTimeout.expect(1).process();
@@ -723,14 +719,14 @@ describe("ngAnimate", function() {
$provide.value('$window', window = angular.mock.createMockWindow());
$animateProvider.register('.custom', function() {
return {
- show : function(element, done) {
+ removeClass : function(element, className, done) {
window.setTimeout(done, 2000);
}
}
});
$animateProvider.register('.other', function() {
return {
- start : function(element, done) {
+ enter : function(element, done) {
window.setTimeout(done, 10000);
}
}
@@ -858,7 +854,7 @@ describe("ngAnimate", function() {
body.append($rootElement);
var flag = false;
- $animate.show(element, function() {
+ $animate.removeClass(element, 'ng-hide', function() {
flag = true;
});
@@ -883,7 +879,7 @@ describe("ngAnimate", function() {
var element = parent.find('span');
var flag = false;
- $animate.show(element, function() {
+ $animate.removeClass(element, 'ng-hide', function() {
flag = true;
});
@@ -907,7 +903,7 @@ describe("ngAnimate", function() {
element.addClass('custom');
var flag = false;
- $animate.show(element, function() {
+ $animate.removeClass(element, 'ng-hide', function() {
flag = true;
});
@@ -930,17 +926,17 @@ describe("ngAnimate", function() {
var element = parent.find('span');
var signature = '';
- $animate.show(element, function() {
+ $animate.removeClass(element, 'ng-hide', function() {
signature += 'A';
});
- $animate.hide(element, function() {
+ $animate.addClass(element, 'ng-hide', function() {
signature += 'B';
});
if($sniffer.transitions) {
window.setTimeout.expect(1).process();
}
- $animate.hide(element); //earlier animation cancelled
+ $animate.addClass(element, 'ng-hide'); //earlier animation cancelled
if($sniffer.transitions) {
window.setTimeout.expect(1).process();
}
@@ -1461,12 +1457,12 @@ describe("ngAnimate", function() {
module(function($animateProvider) {
$animateProvider.register('.displayer', function($window) {
return {
- show : function(element, done) {
+ removeClass : function(element, className, done) {
element.removeClass('hiding');
element.addClass('showing');
$window.setTimeout(done, 25);
},
- hide : function(element, done) {
+ addClass : function(element, className, done) {
element.removeClass('showing');
element.addClass('hiding');
$window.setTimeout(done, 555);
@@ -1486,7 +1482,7 @@ describe("ngAnimate", function() {
expect(element.hasClass('showing')).toBe(false);
expect(element.hasClass('hiding')).toBe(false);
- $animate.hide(element);
+ $animate.addClass(element, 'ng-hide');
if($sniffer.transitions) {
expect(element).toBeShown(); //still showing
@@ -1502,7 +1498,7 @@ describe("ngAnimate", function() {
expect(element.hasClass('showing')).toBe(false);
expect(element.hasClass('hiding')).toBe(true);
- $animate.show(element);
+ $animate.removeClass(element, 'ng-hide');
if($sniffer.transitions) {
expect(element).toBeHidden();