OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src='../../resources/testharness.js'></script> | 4 <script src='../../resources/testharness.js'></script> |
5 <script src='../../resources/testharnessreport.js'></script> | 5 <script src='../../resources/testharnessreport.js'></script> |
6 </head> | 6 </head> |
7 <body> | 7 <body> |
8 <div id='testElement'></div> | 8 <div id='testElement'></div> |
9 | 9 |
10 <script> | 10 <script> |
11 | 11 |
12 testElement.style.width = '10px'; | 12 testElement.style.width = '10px'; |
13 | 13 |
14 var t1 = async_test("Getting a 10px width results in a CSSSimpleLength"); | 14 var t1 = async_test("Getting a 10px width results in a CSSUnitValue"); |
15 function t1Callback(computedStyleMap) { | 15 function t1Callback(computedStyleMap) { |
16 t1.step(function() { | 16 t1.step(function() { |
17 var result = computedStyleMap.get('width'); | 17 var result = computedStyleMap.get('width'); |
18 assert_equals(result.constructor.name, CSSSimpleLength.name); | 18 assert_equals(result.constructor.name, CSSUnitValue.name); |
19 assert_equals(result.cssText, '10px'); | 19 assert_equals(result.cssText, '10px'); |
20 }); | 20 }); |
21 t1.done(); | 21 t1.done(); |
22 } | 22 } |
23 | 23 |
24 var t2 = async_test("getAll for width returns a single value"); | 24 var t2 = async_test("getAll for width returns a single value"); |
25 function t2Callback(computedStyleMap) { | 25 function t2Callback(computedStyleMap) { |
26 t2.step(function() { | 26 t2.step(function() { |
27 testElement.style.width = '20px'; | 27 testElement.style.width = '20px'; |
28 var result = computedStyleMap.getAll('width'); | 28 var result = computedStyleMap.getAll('width'); |
29 assert_equals(result.length, 1); | 29 assert_equals(result.length, 1); |
30 assert_equals(result[0].cssText, '20px'); | 30 assert_equals(result[0].cssText, '20px'); |
31 }); | 31 }); |
32 t2.done(); | 32 t2.done(); |
33 } | 33 } |
34 | 34 |
35 document.onreadystatechange = function() { | 35 document.onreadystatechange = function() { |
36 if(document.readyState == 'complete') { | 36 if(document.readyState == 'complete') { |
37 var computedStyleMap = getComputedStyleMap(testElement); | 37 var computedStyleMap = getComputedStyleMap(testElement); |
38 t1Callback(computedStyleMap); | 38 t1Callback(computedStyleMap); |
39 t2Callback(computedStyleMap); | 39 t2Callback(computedStyleMap); |
40 } | 40 } |
41 }; | 41 }; |
42 | 42 |
43 </script> | 43 </script> |
44 </body> | 44 </body> |
45 </html> | 45 </html> |
OLD | NEW |