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

Commit 952fea6

Browse files
committed
chore(ngAnimate): ensure elapsedTime values are in seconds and millseconds
1 parent 0fca288 commit 952fea6

File tree

1 file changed

+43
-43
lines changed

1 file changed

+43
-43
lines changed

test/ngAnimate/animateSpec.js

+43-43
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ describe("ngAnimate", function() {
246246
$timeout.flush();
247247
expect(child.hasClass('ng-enter')).toBe(true);
248248
expect(child.hasClass('ng-enter-active')).toBe(true);
249-
browserTrigger(element, 'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1000 });
249+
browserTrigger(element, 'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1 });
250250
}
251251

252252
expect(element.contents().length).toBe(1);
@@ -263,7 +263,7 @@ describe("ngAnimate", function() {
263263
$timeout.flush();
264264
expect(child.hasClass('ng-leave')).toBe(true);
265265
expect(child.hasClass('ng-leave-active')).toBe(true);
266-
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1000 });
266+
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1 });
267267
}
268268

269269
expect(element.contents().length).toBe(0);
@@ -299,7 +299,7 @@ describe("ngAnimate", function() {
299299
$timeout.flush();
300300
expect(child.hasClass('ng-hide-remove')).toBe(true);
301301
expect(child.hasClass('ng-hide-remove-active')).toBe(true);
302-
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1000 });
302+
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1 });
303303
}
304304
expect(child.hasClass('ng-hide-remove')).toBe(false);
305305
expect(child.hasClass('ng-hide-remove-active')).toBe(false);
@@ -316,7 +316,7 @@ describe("ngAnimate", function() {
316316
$timeout.flush();
317317
expect(child.hasClass('ng-hide-add')).toBe(true);
318318
expect(child.hasClass('ng-hide-add-active')).toBe(true);
319-
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1000 });
319+
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1 });
320320
}
321321
expect(child).toBeHidden();
322322
}));
@@ -336,7 +336,7 @@ describe("ngAnimate", function() {
336336

337337
expect(child.attr('class')).toContain('ng-enter');
338338
expect(child.attr('class')).toContain('ng-enter-active');
339-
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1000 });
339+
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1 });
340340
$timeout.flush();
341341

342342
//move
@@ -347,30 +347,30 @@ describe("ngAnimate", function() {
347347

348348
expect(child.attr('class')).toContain('ng-move');
349349
expect(child.attr('class')).toContain('ng-move-active');
350-
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1000 });
350+
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1 });
351351
$timeout.flush();
352352

353353
//hide
354354
$animate.addClass(child, 'ng-hide');
355355
$timeout.flush();
356356
expect(child.attr('class')).toContain('ng-hide-add');
357357
expect(child.attr('class')).toContain('ng-hide-add-active');
358-
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1000 });
358+
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1 });
359359

360360
//show
361361
$animate.removeClass(child, 'ng-hide');
362362
$timeout.flush();
363363
expect(child.attr('class')).toContain('ng-hide-remove');
364364
expect(child.attr('class')).toContain('ng-hide-remove-active');
365-
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1000 });
365+
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1 });
366366

367367
//leave
368368
$animate.leave(child);
369369
$rootScope.$digest();
370370
$timeout.flush();
371371
expect(child.attr('class')).toContain('ng-leave');
372372
expect(child.attr('class')).toContain('ng-leave-active');
373-
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1000 });
373+
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1 });
374374
$timeout.flush();
375375
}));
376376

@@ -416,7 +416,7 @@ describe("ngAnimate", function() {
416416

417417
if($sniffer.transitions) {
418418
expect(element.children().length).toBe(1); //still animating
419-
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1000 });
419+
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1 });
420420
}
421421
$timeout.flush(2000);
422422
$timeout.flush(2000);
@@ -433,7 +433,7 @@ describe("ngAnimate", function() {
433433
child.addClass('custom-delay ng-hide');
434434
$animate.removeClass(child, 'ng-hide');
435435
if($sniffer.transitions) {
436-
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1000 });
436+
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1 });
437437
}
438438
$timeout.flush(2000);
439439

@@ -459,7 +459,7 @@ describe("ngAnimate", function() {
459459
expect(completed).toBe(false);
460460
if($sniffer.transitions) {
461461
$timeout.flush();
462-
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1000 });
462+
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1 });
463463
}
464464
$timeout.flush();
465465

@@ -520,7 +520,7 @@ describe("ngAnimate", function() {
520520
$animate.removeClass(element, 'ng-hide');
521521

522522
if($sniffer.transitions) {
523-
browserTrigger(element,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1000 });
523+
browserTrigger(element,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1 });
524524
}
525525
$timeout.flush(2000);
526526
$timeout.flush(20000);
@@ -562,7 +562,7 @@ describe("ngAnimate", function() {
562562

563563
$animate.removeClass(element, 'ng-hide');
564564
if ($sniffer.animations) {
565-
browserTrigger(element,'animationend', { timeStamp: Date.now() + 4000, elapsedTime: 4000 });
565+
browserTrigger(element,'animationend', { timeStamp: Date.now() + 4000, elapsedTime: 4 });
566566
}
567567
expect(element).toBeShown();
568568
}));
@@ -585,7 +585,7 @@ describe("ngAnimate", function() {
585585

586586
$animate.removeClass(element, 'ng-hide');
587587
if ($sniffer.animations) {
588-
browserTrigger(element,'animationend', { timeStamp: Date.now() + 6000, elapsedTime: 6000 });
588+
browserTrigger(element,'animationend', { timeStamp: Date.now() + 6000, elapsedTime: 6 });
589589
}
590590
expect(element).toBeShown();
591591
}));
@@ -608,7 +608,7 @@ describe("ngAnimate", function() {
608608

609609
$animate.removeClass(element, 'ng-hide');
610610
if ($sniffer.animations) {
611-
browserTrigger(element,'animationend', { timeStamp: Date.now() + 2000, elapsedTime: 2000 });
611+
browserTrigger(element,'animationend', { timeStamp: Date.now() + 2000, elapsedTime: 2 });
612612
}
613613
expect(element).toBeShown();
614614
}));
@@ -633,7 +633,7 @@ describe("ngAnimate", function() {
633633

634634
$animate.removeClass(element, 'ng-hide');
635635
if ($sniffer.transitions) {
636-
browserTrigger(element,'animationend', { timeStamp : Date.now() + 20000, elapsedTime: 20000 });
636+
browserTrigger(element,'animationend', { timeStamp : Date.now() + 20000, elapsedTime: 10 });
637637
}
638638
expect(element).toBeShown();
639639
}));
@@ -682,7 +682,7 @@ describe("ngAnimate", function() {
682682
$timeout.flush();
683683
expect(element.hasClass('ng-hide-add')).toBe(true);
684684
expect(element.hasClass('ng-hide-add-active')).toBe(true);
685-
browserTrigger(element,'animationend', { timeStamp: Date.now() + 2000, elapsedTime: 2000 });
685+
browserTrigger(element,'animationend', { timeStamp: Date.now() + 2000, elapsedTime: 2 });
686686
}
687687

688688
expect(element.hasClass('ng-hide-remove-active')).toBe(false);
@@ -774,7 +774,7 @@ describe("ngAnimate", function() {
774774

775775
$animate.removeClass(element, 'ng-hide');
776776
if ($sniffer.transitions) {
777-
browserTrigger(element,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1000 });
777+
browserTrigger(element,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1 });
778778
}
779779
expect(element).toBeShown();
780780
}));
@@ -796,9 +796,9 @@ describe("ngAnimate", function() {
796796
if ($sniffer.transitions) {
797797
expect(element).toBeHidden();
798798
var now = Date.now();
799-
browserTrigger(element,'transitionend', { timeStamp: now + 1000, elapsedTime: 1000 });
800-
browserTrigger(element,'transitionend', { timeStamp: now + 1000, elapsedTime: 1000 });
801-
browserTrigger(element,'transitionend', { timeStamp: now + 2000, elapsedTime: 2000 });
799+
browserTrigger(element,'transitionend', { timeStamp: now + 1000, elapsedTime: 1 });
800+
browserTrigger(element,'transitionend', { timeStamp: now + 1000, elapsedTime: 1 });
801+
browserTrigger(element,'transitionend', { timeStamp: now + 2000, elapsedTime: 2 });
802802
}
803803
expect(element).toBeShown();
804804
}));
@@ -830,9 +830,9 @@ describe("ngAnimate", function() {
830830
$animate.removeClass(element, 'ng-hide');
831831
if ($sniffer.transitions) {
832832
var now = Date.now();
833-
browserTrigger(element,'transitionend', { timeStamp: now + 1000, elapsedTime: 1000 });
834-
browserTrigger(element,'transitionend', { timeStamp: now + 3000, elapsedTime: 3000 });
835-
browserTrigger(element,'transitionend', { timeStamp: now + 3000, elapsedTime: 3000 });
833+
browserTrigger(element,'transitionend', { timeStamp: now + 1000, elapsedTime: 1 });
834+
browserTrigger(element,'transitionend', { timeStamp: now + 3000, elapsedTime: 3 });
835+
browserTrigger(element,'transitionend', { timeStamp: now + 3000, elapsedTime: 3 });
836836
}
837837
expect(element).toBeShown();
838838
}));
@@ -854,7 +854,7 @@ describe("ngAnimate", function() {
854854

855855
$animate.removeClass(element, 'ng-hide');
856856
if ($sniffer.transitions) {
857-
browserTrigger(element,'animationend', { timeStamp: Date.now() + 11000, elapsedTime: 11000 });
857+
browserTrigger(element,'animationend', { timeStamp: Date.now() + 11000, elapsedTime: 11 });
858858
}
859859
expect(element).toBeShown();
860860
}));
@@ -876,7 +876,7 @@ describe("ngAnimate", function() {
876876
$timeout.flush();
877877
expect(element.hasClass('ng-hide-remove')).toBe(true);
878878
expect(element.hasClass('ng-hide-remove-active')).toBe(true);
879-
browserTrigger(element,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1000 });
879+
browserTrigger(element,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1 });
880880
}
881881
expect(element.hasClass('ng-hide-remove')).toBe(false);
882882
expect(element.hasClass('ng-hide-remove-active')).toBe(false);
@@ -976,7 +976,7 @@ describe("ngAnimate", function() {
976976
expect(element.hasClass('abc')).toBe(true);
977977
expect(element.hasClass('ng-enter')).toBe(true);
978978
expect(element.hasClass('ng-enter-active')).toBe(true);
979-
browserTrigger(element,'transitionend', { timeStamp: Date.now() + 22000, elapsedTime: 22000 });
979+
browserTrigger(element,'transitionend', { timeStamp: Date.now() + 22000, elapsedTime: 22 });
980980
$timeout.flush();
981981
}
982982
expect(element.hasClass('abc')).toBe(true);
@@ -990,7 +990,7 @@ describe("ngAnimate", function() {
990990
expect(element.hasClass('xyz')).toBe(true);
991991
expect(element.hasClass('ng-enter')).toBe(true);
992992
expect(element.hasClass('ng-enter-active')).toBe(true);
993-
browserTrigger(element,'transitionend', { timeStamp: Date.now() + 11000, elapsedTime: 11000 });
993+
browserTrigger(element,'transitionend', { timeStamp: Date.now() + 11000, elapsedTime: 11 });
994994
$timeout.flush();
995995
}
996996
expect(element.hasClass('xyz')).toBe(true);
@@ -1022,7 +1022,7 @@ describe("ngAnimate", function() {
10221022
expect(element.hasClass('ng-enter-active')).toBe(true);
10231023
expect(element.hasClass('one-active')).toBe(false);
10241024
expect(element.hasClass('two-active')).toBe(false);
1025-
browserTrigger(element,'transitionend', { timeStamp: Date.now() + 3000, elapsedTime: 3000 });
1025+
browserTrigger(element,'transitionend', { timeStamp: Date.now() + 3000, elapsedTime: 3 });
10261026
}
10271027

10281028
expect(element.hasClass('one')).toBe(true);
@@ -1167,7 +1167,7 @@ describe("ngAnimate", function() {
11671167
});
11681168

11691169
if($sniffer.transitions) {
1170-
browserTrigger(element,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1000 });
1170+
browserTrigger(element,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1 });
11711171
}
11721172
$timeout.flush();
11731173
expect(flag).toBe(true);
@@ -1340,7 +1340,7 @@ describe("ngAnimate", function() {
13401340
expect(element.hasClass('klass')).toBe(false);
13411341
expect(element.hasClass('klass-add')).toBe(true);
13421342
expect(element.hasClass('klass-add-active')).toBe(true);
1343-
browserTrigger(element,'transitionend', { timeStamp: Date.now() + 3000, elapsedTime: 3000 });
1343+
browserTrigger(element,'transitionend', { timeStamp: Date.now() + 3000, elapsedTime: 3 });
13441344
}
13451345

13461346
//this cancels out the older animation
@@ -1355,7 +1355,7 @@ describe("ngAnimate", function() {
13551355
expect(element.hasClass('klass-add-active')).toBe(false);
13561356

13571357
expect(element.hasClass('klass-remove')).toBe(true);
1358-
browserTrigger(element,'transitionend', { timeStamp: Date.now() + 3000, elapsedTime: 3000 });
1358+
browserTrigger(element,'transitionend', { timeStamp: Date.now() + 3000, elapsedTime: 3 });
13591359
}
13601360
$timeout.flush();
13611361

@@ -1415,7 +1415,7 @@ describe("ngAnimate", function() {
14151415
$timeout.flush();
14161416
expect(element.hasClass('klass-add')).toBe(true);
14171417
expect(element.hasClass('klass-add-active')).toBe(true);
1418-
browserTrigger(element,'transitionend', { timeStamp: Date.now() + 11000, elapsedTime: 11000 });
1418+
browserTrigger(element,'transitionend', { timeStamp: Date.now() + 11000, elapsedTime: 11 });
14191419
expect(element.hasClass('klass-add')).toBe(false);
14201420
expect(element.hasClass('klass-add-active')).toBe(false);
14211421
}
@@ -1431,7 +1431,7 @@ describe("ngAnimate", function() {
14311431
$timeout.flush();
14321432
expect(element.hasClass('klass-remove')).toBe(true);
14331433
expect(element.hasClass('klass-remove-active')).toBe(true);
1434-
browserTrigger(element,'transitionend', { timeStamp: Date.now() + 11000, elapsedTime: 11000 });
1434+
browserTrigger(element,'transitionend', { timeStamp: Date.now() + 11000, elapsedTime: 11 });
14351435
expect(element.hasClass('klass-remove')).toBe(false);
14361436
expect(element.hasClass('klass-remove-active')).toBe(false);
14371437
}
@@ -1467,7 +1467,7 @@ describe("ngAnimate", function() {
14671467

14681468
expect(element.hasClass('one-add-active')).toBe(true);
14691469
expect(element.hasClass('two-add-active')).toBe(true);
1470-
browserTrigger(element,'transitionend', { timeStamp: Date.now() + 7000, elapsedTime: 7000 });
1470+
browserTrigger(element,'transitionend', { timeStamp: Date.now() + 7000, elapsedTime: 7 });
14711471

14721472
expect(element.hasClass('one-add')).toBe(false);
14731473
expect(element.hasClass('one-add-active')).toBe(false);
@@ -1512,7 +1512,7 @@ describe("ngAnimate", function() {
15121512

15131513
expect(element.hasClass('one-remove-active')).toBe(true);
15141514
expect(element.hasClass('two-remove-active')).toBe(true);
1515-
browserTrigger(element,'transitionend', { timeStamp: Date.now() + 9000, elapsedTime: 9000 });
1515+
browserTrigger(element,'transitionend', { timeStamp: Date.now() + 9000, elapsedTime: 9 });
15161516

15171517
expect(element.hasClass('one-remove')).toBe(false);
15181518
expect(element.hasClass('one-remove-active')).toBe(false);
@@ -1562,7 +1562,7 @@ describe("ngAnimate", function() {
15621562
$timeout.flush();
15631563
expect(child.hasClass('ng-enter')).toBe(true);
15641564
expect(child.hasClass('ng-enter-active')).toBe(true);
1565-
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1000 });
1565+
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1 });
15661566
}
15671567

15681568
expect(child.hasClass('ng-enter')).toBe(false);
@@ -1585,7 +1585,7 @@ describe("ngAnimate", function() {
15851585
$timeout.flush();
15861586
expect(child.hasClass('ng-enter')).toBe(true);
15871587
expect(child.hasClass('ng-enter-active')).toBe(true);
1588-
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 9000, elapsedTime: 9000 });
1588+
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 9000, elapsedTime: 9 });
15891589
}
15901590
expect(child.hasClass('ng-enter')).toBe(false);
15911591
expect(child.hasClass('ng-enter-active')).toBe(false);
@@ -1612,7 +1612,7 @@ describe("ngAnimate", function() {
16121612
$rootScope.$digest();
16131613
$timeout.flush();
16141614

1615-
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 2000, elapsedTime: 2000 });
1615+
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 2000, elapsedTime: 2 });
16161616

16171617
expect(child.css(propertyKey)).toBe('background-color');
16181618
child.remove();
@@ -1670,7 +1670,7 @@ describe("ngAnimate", function() {
16701670
$timeout.flush(10);
16711671

16721672
if($sniffer.transitions) {
1673-
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1000 });
1673+
browserTrigger(child,'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1 });
16741674
}
16751675

16761676
expect(child.hasClass('i-was-animated')).toBe(true);
@@ -1942,7 +1942,7 @@ describe("ngAnimate", function() {
19421942
expect(child.hasClass('ng-enter')).toBe(true);
19431943
expect(child.hasClass('ng-enter-active')).toBe(true);
19441944

1945-
browserTrigger(child, 'transitionend', { timeStamp: Date.now() + 2000, elapsedTime: 2000 });
1945+
browserTrigger(child, 'transitionend', { timeStamp: Date.now() + 2000, elapsedTime: 2 });
19461946

19471947
expect(child.hasClass('ng-enter')).toBe(false);
19481948
expect(child.hasClass('ng-enter-active')).toBe(false);
@@ -2039,7 +2039,7 @@ describe("ngAnimate", function() {
20392039
expect(element[0].querySelectorAll('.ng-enter-active').length).toBe(5);
20402040

20412041
angular.forEach(element.children(), function(kid) {
2042-
browserTrigger(kid, 'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1000 });
2042+
browserTrigger(kid, 'transitionend', { timeStamp: Date.now() + 1000, elapsedTime: 1 });
20432043
});
20442044

20452045
expect(element[0].querySelectorAll('.ng-enter-active').length).toBe(0);

0 commit comments

Comments
 (0)