Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
chore(animateSpec): provide meaningful CSS class names in animation t…
Browse files Browse the repository at this point in the history
…ests
  • Loading branch information
matsko committed Nov 6, 2013
1 parent b89584d commit 7d2d257
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions test/ngAnimate/animateSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ describe("ngAnimate", function() {
var captured = false;
module(function($provide, $animateProvider) {
$provide.value('$rootElement', rootElm);
$animateProvider.register('.ani', function() {
$animateProvider.register('.capture-animation', function() {
return {
addClass : function(element, className, done) {
captured = true;
Expand All @@ -147,7 +147,7 @@ describe("ngAnimate", function() {

$animate.enabled(true);

var element = $compile('<div class="ani"></div>')($rootScope);
var element = $compile('<div class="capture-animation"></div>')($rootScope);
rootElm.append(element);

expect(captured).toBe(false);
Expand Down Expand Up @@ -695,17 +695,17 @@ describe("ngAnimate", function() {

$animate.enabled(true);

ss.addRule('.ani.ng-enter, .ani.ng-leave, .ani-fake.ng-enter, .ani-fake.ng-leave',
ss.addRule('.real-animation.ng-enter, .real-animation.ng-leave, .real-animation-fake.ng-enter, .real-animation-fake.ng-leave',
'-webkit-animation:1s my_animation;' +
'animation:1s my_animation;');

ss.addRule('.ani.ng-enter-stagger, .ani.ng-leave-stagger',
ss.addRule('.real-animation.ng-enter-stagger, .real-animation.ng-leave-stagger',
'-webkit-animation-delay:0.1s;' +
'-webkit-animation-duration:0s;' +
'animation-delay:0.1s;' +
'animation-duration:0s;');

ss.addRule('.ani-fake.ng-enter-stagger, .ani-fake.ng-leave-stagger',
ss.addRule('.fake-animation.ng-enter-stagger, .fake-animation.ng-leave-stagger',
'-webkit-animation-delay:0.1s;' +
'-webkit-animation-duration:1s;' +
'animation-delay:0.1s;' +
Expand All @@ -716,7 +716,7 @@ describe("ngAnimate", function() {
var elements = [];
for(var i = 0; i < 5; i++) {
var newScope = $rootScope.$new();
var element = $compile('<div class="ani"></div>')(newScope);
var element = $compile('<div class="real-animation"></div>')(newScope);
$animate.enter(element, container);
elements.push(element);
};
Expand All @@ -733,7 +733,7 @@ describe("ngAnimate", function() {
for(var i = 0; i < 5; i++) {
dealoc(elements[i]);
var newScope = $rootScope.$new();
var element = $compile('<div class="ani-fake"></div>')(newScope);
var element = $compile('<div class="fake-animation"></div>')(newScope);
$animate.enter(element, container);
elements[i] = element;
};
Expand All @@ -755,11 +755,11 @@ describe("ngAnimate", function() {

$animate.enabled(true);

ss.addRule('.ani.ng-enter, .ani.ng-leave',
ss.addRule('.stagger-animation.ng-enter, .stagger-animation.ng-leave',
'-webkit-animation:my_animation 1s 1s, your_animation 1s 2s;' +
'animation:my_animation 1s 1s, your_animation 1s 2s;');

ss.addRule('.ani.ng-enter-stagger, .ani.ng-leave-stagger',
ss.addRule('.stagger-animation.ng-enter-stagger, .stagger-animation.ng-leave-stagger',
'-webkit-animation-delay:0.1s;' +
'animation-delay:0.1s;');

Expand All @@ -768,7 +768,7 @@ describe("ngAnimate", function() {
var elements = [];
for(var i = 0; i < 4; i++) {
var newScope = $rootScope.$new();
var element = $compile('<div class="ani"></div>')(newScope);
var element = $compile('<div class="stagger-animation"></div>')(newScope);
$animate.enter(element, container);
elements.push(element);
};
Expand Down Expand Up @@ -985,17 +985,17 @@ describe("ngAnimate", function() {

$animate.enabled(true);

ss.addRule('.ani.ng-enter, .ani.ng-leave, .ani-fake.ng-enter, .ani-fake.ng-leave',
ss.addRule('.real-animation.ng-enter, .real-animation.ng-leave, .real-animation-fake.ng-enter, .real-animation-fake.ng-leave',
'-webkit-transition:1s linear all;' +
'transition:1s linear all;');

ss.addRule('.ani.ng-enter-stagger, .ani.ng-leave-stagger',
ss.addRule('.real-animation.ng-enter-stagger, .real-animation.ng-leave-stagger',
'-webkit-transition-delay:0.1s;' +
'-webkit-transition-duration:0s;' +
'transition-delay:0.1s;' +
'transition-duration:0s;');

ss.addRule('.ani-fake.ng-enter-stagger, .ani-fake.ng-leave-stagger',
ss.addRule('.fake-animation.ng-enter-stagger, .fake-animation.ng-leave-stagger',
'-webkit-transition-delay:0.1s;' +
'-webkit-transition-duration:1s;' +
'transition-delay:0.1s;' +
Expand All @@ -1006,7 +1006,7 @@ describe("ngAnimate", function() {
var elements = [];
for(var i = 0; i < 5; i++) {
var newScope = $rootScope.$new();
var element = $compile('<div class="ani"></div>')(newScope);
var element = $compile('<div class="real-animation"></div>')(newScope);
$animate.enter(element, container);
elements.push(element);
};
Expand All @@ -1023,7 +1023,7 @@ describe("ngAnimate", function() {
for(var i = 0; i < 5; i++) {
dealoc(elements[i]);
var newScope = $rootScope.$new();
var element = $compile('<div class="ani-fake"></div>')(newScope);
var element = $compile('<div class="fake-animation"></div>')(newScope);
$animate.enter(element, container);
elements[i] = element;
};
Expand All @@ -1045,11 +1045,11 @@ describe("ngAnimate", function() {

$animate.enabled(true);

ss.addRule('.ani.ng-enter, .ani.ng-leave',
ss.addRule('.stagger-animation.ng-enter, .ani.ng-leave',
'-webkit-transition:1s linear color 2s, 3s linear font-size 4s;' +
'transition:1s linear color 2s, 3s linear font-size 4s;');

ss.addRule('.ani.ng-enter-stagger, .ani.ng-leave-stagger',
ss.addRule('.stagger-animation.ng-enter-stagger, .ani.ng-leave-stagger',
'-webkit-transition-delay:0.1s;' +
'transition-delay:0.1s;');

Expand All @@ -1058,7 +1058,7 @@ describe("ngAnimate", function() {
var elements = [];
for(var i = 0; i < 4; i++) {
var newScope = $rootScope.$new();
var element = $compile('<div class="ani"></div>')(newScope);
var element = $compile('<div class="stagger-animation"></div>')(newScope);
$animate.enter(element, container);
elements.push(element);
};
Expand All @@ -1080,13 +1080,13 @@ describe("ngAnimate", function() {

$animate.enabled(true);

ss.addRule('.ani.ng-enter, .ani.ng-leave',
ss.addRule('.stagger-animation.ng-enter, .stagger-animation.ng-leave',
'-webkit-animation:my_animation 1s 1s, your_animation 1s 2s;' +
'animation:my_animation 1s 1s, your_animation 1s 2s;' +
'-webkit-transition:1s linear all 1s;' +
'transition:1s linear all 1s;');

ss.addRule('.ani.ng-enter-stagger, .ani.ng-leave-stagger',
ss.addRule('.stagger-animation.ng-enter-stagger, .stagger-animation.ng-leave-stagger',
'-webkit-transition-delay:0.1s;' +
'transition-delay:0.1s;' +
'-webkit-animation-delay:0.2s;' +
Expand All @@ -1097,7 +1097,7 @@ describe("ngAnimate", function() {
var elements = [];
for(var i = 0; i < 3; i++) {
var newScope = $rootScope.$new();
var element = $compile('<div class="ani"></div>')(newScope);
var element = $compile('<div class="stagger-animation"></div>')(newScope);
$animate.enter(element, container);
elements.push(element);
};
Expand Down Expand Up @@ -1763,16 +1763,16 @@ describe("ngAnimate", function() {

if (!$sniffer.animations) return;

ss.addRule('.ani.ng-enter', '-webkit-animation: my_animation 2s linear;' +
'animation: my_animation 2s linear');
ss.addRule('.sleek-animation.ng-enter', '-webkit-animation: my_animation 2s linear;' +
'animation: my_animation 2s linear');

ss.addRule('.trans.ng-enter', '-webkit-transition:1s linear all;' +
'transition:1s linear all');

var propertyKey = ($sniffer.vendorPrefix == 'Webkit' ? '-webkit-' : '') + 'transition-property';

var element = html($compile('<div>...</div>')($rootScope));
var child = $compile('<div class="ani">...</div>')($rootScope);
var child = $compile('<div class="skeep-animation">...</div>')($rootScope);
child.css(propertyKey,'background-color');

$animate.enter(child, element);
Expand All @@ -1784,7 +1784,7 @@ describe("ngAnimate", function() {
expect(child.css(propertyKey)).toBe('background-color');
child.remove();

child = $compile('<div class="ani">...</div>')($rootScope);
child = $compile('<div class="sleek-animation">...</div>')($rootScope);
child.attr('class','trans');
$animate.enter(child, element);
$rootScope.$digest();
Expand Down

0 comments on commit 7d2d257

Please sign in to comment.