Skip to content

Commit 8780b6b

Browse files
committed
Merge pull request #307 from rjwright/RenameTestharnessTests
Rename testharness tests
2 parents af4319a + 4030495 commit 8780b6b

File tree

5 files changed

+132
-132
lines changed

5 files changed

+132
-132
lines changed

test/blink/get-animation-players.html

Lines changed: 0 additions & 90 deletions
This file was deleted.

test/blink/get-animations.html

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<!DOCTYPE html>
2+
<script src="testharness/testharness.js"></script>
3+
<script src="testharness/testharnessreport.js"></script>
4+
5+
<div id='container'>
6+
<div id='element'></div>
7+
</div>
8+
9+
<script>
10+
11+
var container = document.getElementById('container');
12+
var element = document.getElementById('element');
13+
14+
test(function() {
15+
assert_equals(document.timeline.getAnimations().length, 0);
16+
assert_equals(container.getAnimations().length, 0);
17+
assert_equals(element.getAnimations().length, 0);
18+
19+
var animation = element.animate([], 1000);
20+
assert_equals(document.timeline.getAnimations().length, 1);
21+
assert_equals(document.timeline.getAnimations()[0], animation);
22+
23+
var animation2 = container.animate([], 1000);
24+
assert_equals(document.timeline.getAnimations().length, 2);
25+
assert_equals(document.timeline.getAnimations()[0], animation);
26+
assert_equals(document.timeline.getAnimations()[1], animation2);
27+
28+
animation.finish();
29+
assert_equals(document.timeline.getAnimations().length, 1);
30+
assert_equals(document.timeline.getAnimations()[0], animation2);
31+
32+
animation2.finish();
33+
assert_equals(document.timeline.getAnimations().length, 0);
34+
}, 'Timeline getAnimations()');
35+
36+
test(function() {
37+
assert_equals(document.timeline.getAnimations().length, 0);
38+
assert_equals(container.getAnimations().length, 0);
39+
assert_equals(element.getAnimations().length, 0);
40+
41+
var animation = element.animate([], 1000);
42+
assert_equals(document.timeline.getAnimations().length, 1);
43+
assert_equals(document.timeline.getAnimations()[0], animation);
44+
assert_equals(container.getAnimations().length, 0);
45+
assert_equals(element.getAnimations().length, 1);
46+
assert_equals(element.getAnimations()[0], animation);
47+
48+
var animation2 = container.animate([], 1000);
49+
assert_equals(document.timeline.getAnimations().length, 2);
50+
assert_equals(document.timeline.getAnimations()[0], animation);
51+
assert_equals(document.timeline.getAnimations()[1], animation2);
52+
assert_equals(container.getAnimations().length, 1);
53+
assert_equals(container.getAnimations()[0], animation2);
54+
assert_equals(element.getAnimations().length, 1);
55+
assert_equals(element.getAnimations()[0], animation);
56+
57+
animation.finish();
58+
assert_equals(document.timeline.getAnimations().length, 1);
59+
assert_equals(document.timeline.getAnimations()[0], animation2);
60+
assert_equals(container.getAnimations().length, 1);
61+
assert_equals(container.getAnimations()[0], animation2);
62+
assert_equals(element.getAnimations().length, 0);
63+
64+
animation2.finish();
65+
assert_equals(document.timeline.getAnimations().length, 0);
66+
assert_equals(container.getAnimations().length, 0);
67+
assert_equals(element.getAnimations().length, 0);
68+
69+
}, 'Animatable getAnimations()');
70+
71+
test(function() {
72+
assert_equals(document.timeline.getAnimations().length, 0);
73+
assert_equals(container.getAnimations().length, 0);
74+
assert_equals(element.getAnimations().length, 0);
75+
76+
var animation = element.animate([], {duration: 1000, delay: 500});
77+
assert_equals(document.timeline.getAnimations().length, 1);
78+
assert_equals(document.timeline.getAnimations()[0], animation);
79+
assert_equals(container.getAnimations().length, 0);
80+
assert_equals(element.getAnimations().length, 1);
81+
assert_equals(element.getAnimations()[0], animation);
82+
83+
animation.finish();
84+
assert_equals(document.timeline.getAnimations().length, 0);
85+
assert_equals(container.getAnimations().length, 0);
86+
assert_equals(element.getAnimations().length, 0);
87+
88+
}, 'getAnimations() with delays');
89+
90+
</script>

test/blink/get-css-animations.html

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!DOCTYPE html>
2+
<script src="testharness/testharness.js"></script>
3+
<script src="testharness/testharnessreport.js"></script>
4+
<style>
5+
@keyframes test {
6+
from { opacity: 0; }
7+
to { opacity: 1; }
8+
}
9+
.cssAnimation {
10+
animation: test 2s;
11+
}
12+
</style>
13+
<div id='container'>
14+
<div id='element'></div>
15+
</div>
16+
17+
<script>
18+
async_test(function(t) {
19+
assert_equals(document.timeline.getAnimations().length, 0);
20+
assert_equals(container.getAnimations().length, 0);
21+
assert_equals(element.getAnimations().length, 0);
22+
23+
element.className = 'cssAnimation';
24+
onload = function () {
25+
t.step(function() {
26+
var animations = document.timeline.getAnimations();
27+
assert_equals(animations.length, 1);
28+
assert_equals(container.getAnimations().length, 0);
29+
assert_equals(element.getAnimations().length, 1);
30+
31+
animations[0].finish();
32+
assert_equals(document.timeline.getAnimations().length, 0);
33+
assert_equals(container.getAnimations().length, 0);
34+
assert_equals(element.getAnimations().length, 0);
35+
t.done();
36+
});
37+
}
38+
}, 'getAnimations() with cssanimations');
39+
40+
</script>

test/blink/get-css-players.html

Lines changed: 0 additions & 40 deletions
This file was deleted.

test/testharness-tests.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ var testHarnessTests = [
99
'blink/out-of-order-keyframes.html',
1010
'blink/same-offset-keyframes.html',
1111
'blink/eased-keyframes.html',
12-
'blink/get-animation-players.html',
12+
'blink/get-animations.html',
1313
];
1414

1515
var testHarnessFailures = [
16-
'blink/get-css-players.html',
16+
'blink/get-css-animations.html',
1717
];
1818

1919
var interpolationTests = [

0 commit comments

Comments
 (0)
close