1 <!DOCTYPE html>
2 <html><head>
3 <meta charset="utf-8">
4 <title>CSS Transitions Test: Parsing transition-delay</title>
5 <meta content="Test checks that transition-delay values are parsed properly" name="assert">
6 <link href="http://www.w3.org/TR/css3-transitions/#transition-delay-property" rel="help" title="2.4. The 'transition-delay' Property">
7 <link href="http://www.w3.org/TR/css3-values/#time" rel="help" title="CSS Values and Units Module Level 3 - 6.2. Times: the ‘<time>’ type and ‘s’, ‘ms’ units">
8 <link href="http://rodneyrehm.de/en/" rel="author" title="Rodney Rehm">
9 <meta content="dom" name="flags">
10
11 <script src="/resources/testharness.js" type="text/javascript"></script>
12 <script src="/resources/testharnessreport.js" type="text/javascript"></script>
13
14 <script src="./support/vendorPrefix.js" type="text/javascript"></script>
15 <script src="./support/helper.js" type="text/javascript"></script>
16
17 <script id="metadata_cache">/*
18 {
19 "parse '10.2s'": {},
20 "parse '1s'": {},
21 "parse '0.1s'": {},
22 "parse '0.01s'": {},
23 "parse '0.001s'": {},
24 "parse '0.009s'": {},
25 "parse '0s'": {},
26 "parse '.0s'": {},
27 "parse '0.0s'": {},
28 "parse '.3s'": {},
29 "parse '-5s'": {},
30 "parse '10200ms'": {},
31 "parse '1000ms'": {},
32 "parse '100ms'": {},
33 "parse '10ms'": {},
34 "parse '9ms'": {},
35 "parse '1ms'": {},
36 "parse '0ms'": {},
37 "parse '-500ms'": {},
38 "parse '1s, 0.1s, 10ms'": {},
39 "parse 'foobar'": { "flags": "invalid" }
40 }
41 */</script>
42 </head>
43 <body>
44 <!-- required by testharnessreport.js -->
45 <div id="log"></div>
46 <!-- elements used for testing -->
47 <div id="container">
48 <div id="transition"></div>
49 </div>
50
51 <script>
52 var transition = document.getElementById('transition');
53 // <time> [, <time>]*
54 var values = {
55 // seconds
56 '10.2s': '10.2s',
57 '1s': '1s',
58 '0.1s': '0.1s',
59 '0.01s': '0.01s',
60 '0.001s': '0.001s',
61 '0.009s': '0.009s',
62 '0s': '0s',
63 '0s': '0s',
64 '.0s': '0s',
65 '0.0s': '0s',
66 '.3s': '0.3s',
67 '-5s' : '-5s',
68 // milliseconds
69 '10200ms': '10.2s',
70 '1000ms': '1s',
71 '100ms': '0.1s',
72 '10ms': '0.01s',
73 '9ms': '0.009s',
74 '1ms': '0.001s',
75 '0ms': '0s',
76 '-500ms' : '-0.5s',
77 // combination
78 '1s, 0.1s, 10ms': '1s, 0.1s, 0.01s',
79 // invalid
80 'foobar': '0s'
81 };
82
83 // these tests are supposed to fail and
84 // possibly make the engine issue a parser warning
85 var invalidTests = {
86 'foobar': true
87 };
88
89 for (var key in values) {
90 if (Object.prototype.hasOwnProperty.call(values, key)) {
91 test(function() {
92 setStyle('#transition', {
93 'transition-delay': key
94 });
95 var result = computedStyle(transition, 'transition-delay');
96 assert_equals(result, values[key], "Expected computed value");
97 }, "parse '" + key + "'",
98 {
99 // mark tests that fail as such
100 flags: invalidTests[key] ? "invalid" : ""
101 });
102 }
103 }
104 </script>
105
106
107 </body></html>