Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/web-animations/animation-effect-timing/duration.html

Issue 1883663003: Revert of Import web-platform-tests@5a8700479d98852455bee6117558897867eb278a (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@wpt-sync
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <meta charset=utf-8>
3 <title>duration tests</title>
4 <link rel="help" href="http://w3c.github.io/web-animations/#dom-animationeffectt iming-duration">
5 <link rel="author" title="Ryo Motozawa" href="mailto:motozawa@mozilla-japan.org" >
6 <script src="../../../../resources/testharness.js"></script>
7 <script src="../../../../resources/testharnessreport.js"></script>
8 <script src="../testcommon.js"></script>
9 <body>
10 <div id="log"></div>
11 <script>
12 'use strict';
13
14 test(function(t) {
15 var div = createDiv(t);
16 var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
17 anim.effect.timing.duration = 123.45;
18 assert_approx_equals(anim.effect.timing.duration, 123.45, 0.000001,
19 'set duration 123.45');
20 assert_approx_equals(anim.effect.getComputedTiming().duration, 123.45,
21 0.000001,
22 'getComputedTiming() after set duration 123.45');
23 }, 'set duration 123.45');
24
25 test(function(t) {
26 var div = createDiv(t);
27 var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
28 anim.effect.timing.duration = 'auto';
29 assert_equals(anim.effect.timing.duration, 'auto', 'set duration \'auto\'');
30 assert_equals(anim.effect.getComputedTiming().duration, 0,
31 'getComputedTiming() after set duration \'auto\'');
32 }, 'set duration auto');
33
34 test(function(t) {
35 var div = createDiv(t);
36 var anim = div.animate({ opacity: [ 0, 1 ] }, { duration: 'auto' });
37 assert_equals(anim.effect.timing.duration, 'auto', 'set duration \'auto\'');
38 assert_equals(anim.effect.getComputedTiming().duration, 0,
39 'getComputedTiming() after set duration \'auto\'');
40 }, 'set auto duration in animate as object');
41
42 test(function(t) {
43 var div = createDiv(t);
44 var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
45 anim.effect.timing.duration = Infinity;
46 assert_equals(anim.effect.timing.duration, Infinity, 'set duration Infinity');
47 assert_equals(anim.effect.getComputedTiming().duration, Infinity,
48 'getComputedTiming() after set duration Infinity');
49 }, 'set duration Infinity');
50
51 test(function(t) {
52 var div = createDiv(t);
53 assert_throws({ name: 'TypeError' }, function() {
54 div.animate({ opacity: [ 0, 1 ] }, -1);
55 });
56 }, 'set negative duration in animate using a duration parameter');
57
58 test(function(t) {
59 var div = createDiv(t);
60 assert_throws({ name: 'TypeError' }, function() {
61 div.animate({ opacity: [ 0, 1 ] }, -Infinity);
62 });
63 }, 'set negative Infinity duration in animate using a duration parameter');
64
65 test(function(t) {
66 var div = createDiv(t);
67 assert_throws({ name: 'TypeError' }, function() {
68 div.animate({ opacity: [ 0, 1 ] }, NaN);
69 });
70 }, 'set NaN duration in animate using a duration parameter');
71
72 test(function(t) {
73 var div = createDiv(t);
74 assert_throws({ name: 'TypeError' }, function() {
75 div.animate({ opacity: [ 0, 1 ] }, { duration: -1 });
76 });
77 }, 'set negative duration in animate using an options object');
78
79 test(function(t) {
80 var div = createDiv(t);
81 assert_throws({ name: 'TypeError' }, function() {
82 div.animate({ opacity: [ 0, 1 ] }, { duration: -Infinity });
83 });
84 }, 'set negative Infinity duration in animate using an options object');
85
86 test(function(t) {
87 var div = createDiv(t);
88 assert_throws({ name: 'TypeError' }, function() {
89 div.animate({ opacity: [ 0, 1 ] }, { duration: NaN });
90 });
91 }, 'set NaN duration in animate using an options object');
92
93 test(function(t) {
94 var div = createDiv(t);
95 assert_throws({ name: 'TypeError' }, function() {
96 div.animate({ opacity: [ 0, 1 ] }, { duration: 'abc' });
97 });
98 }, 'set abc string duration in animate using an options object');
99
100 test(function(t) {
101 var div = createDiv(t);
102 assert_throws({ name: 'TypeError' }, function() {
103 div.animate({ opacity: [ 0, 1 ] }, { duration: '100' });
104 });
105 }, 'set 100 string duration in animate using an options object');
106
107 test(function(t) {
108 var div = createDiv(t);
109 var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
110 assert_throws({ name: 'TypeError' }, function() {
111 anim.effect.timing.duration = -1;
112 });
113 }, 'set negative duration');
114
115 test(function(t) {
116 var div = createDiv(t);
117 var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
118 assert_throws({ name: 'TypeError' }, function() {
119 anim.effect.timing.duration = -Infinity;
120 });
121 }, 'set negative Infinity duration');
122
123 test(function(t) {
124 var div = createDiv(t);
125 var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
126 assert_throws({ name: 'TypeError' }, function() {
127 anim.effect.timing.duration = NaN;
128 });
129 }, 'set NaN duration');
130
131 test(function(t) {
132 var div = createDiv(t);
133 var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
134 assert_throws({ name: 'TypeError' }, function() {
135 anim.effect.timing.duration = 'abc';
136 });
137 }, 'set duration abc');
138
139 test(function(t) {
140 var div = createDiv(t);
141 var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
142 assert_throws({ name: 'TypeError' }, function() {
143 anim.effect.timing.duration = '100';
144 });
145 }, 'set duration string 100');
146
147
148 </script>
149 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698