OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../resources/testharness.js"></script> | 2 <script src="../../resources/testharness.js"></script> |
3 <script src="../../resources/testharnessreport.js"></script> | 3 <script src="../../resources/testharnessreport.js"></script> |
4 | 4 |
5 <div id="testElement">text</div> | 5 <div id="testElement"></div> |
6 | 6 |
7 <script> | 7 <script> |
8 | 8 |
9 EPSILON = 0.000001; | 9 EPSILON = 0.000001; |
10 | 10 |
11 var properties = { | 11 var properties = { |
12 'animation-iteration-count': 1, | 12 'animation-iteration-count': 1, |
13 'column-count': 2, | 13 'column-count': 2, |
14 'opacity': 0.3, | 14 'opacity': 0.3, |
15 'orphans': 4, | 15 'orphans': 4, |
16 'widows': 5, | 16 'widows': 5, |
17 }; | 17 }; |
18 | 18 |
19 var computedMap = getComputedStyleMap(testElement); | 19 var computedMap = getComputedStyleMap(testElement); |
20 | 20 |
21 test(function() { | 21 test(function() { |
22 for (var property in properties) { | 22 for (var property in properties) { |
23 var value = properties[property]; | 23 var value = properties[property]; |
24 testElement.style[property] = "" + value; | 24 testElement.style[property] = "" + value; |
25 var result = computedMap.get(property); | 25 var result = computedMap.get(property); |
26 assert_equals(result.constructor.name, CSSNumberValue.name); | 26 assert_equals(result.constructor.name, CSSUnitValue.name); |
27 assert_approx_equals(result.value, value, EPSILON); | 27 assert_approx_equals(result.value, value, EPSILON); |
28 } | 28 } |
29 }, "Single valued CSSNumberValues can be retrieved from Computed StyleMap"); | 29 }, "Single valued CSSUnitValues can be retrieved from Computed StyleMap"); |
30 | 30 |
31 test(function() { | 31 test(function() { |
32 testElement.style.animationIterationCount = "6.2, 9.8, 1"; | 32 testElement.style.animationIterationCount = "6.2, 9.8, 1"; |
33 | 33 |
34 var result = computedMap.getAll('animation-iteration-count'); | 34 var result = computedMap.getAll('animation-iteration-count'); |
35 assert_equals(result.length, 3); | 35 assert_equals(result.length, 3); |
36 assert_equals(result[0].constructor.name, CSSNumberValue.name); | 36 assert_equals(result[0].constructor.name, CSSUnitValue.name); |
37 assert_equals(result[1].constructor.name, CSSNumberValue.name); | 37 assert_equals(result[1].constructor.name, CSSUnitValue.name); |
38 assert_equals(result[2].constructor.name, CSSNumberValue.name); | 38 assert_equals(result[2].constructor.name, CSSUnitValue.name); |
39 assert_approx_equals(result[0].value, 6.2, EPSILON); | 39 assert_approx_equals(result[0].value, 6.2, EPSILON); |
40 assert_approx_equals(result[1].value, 9.8, EPSILON); | 40 assert_approx_equals(result[1].value, 9.8, EPSILON); |
41 assert_approx_equals(result[2].value, 1, EPSILON); | 41 assert_approx_equals(result[2].value, 1, EPSILON); |
42 }, "Can retrieve list of CSSNumberValues from list-valued property"); | 42 }, "Can retrieve list of CSSUnitValues from list-valued property"); |
43 | 43 |
44 </script> | 44 </script> |
OLD | NEW |