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.lineHeight = '10px'; | 12 testElement.style.lineHeight = '10px'; |
13 testElement.style.fontSize = '100px'; | 13 testElement.style.fontSize = '100px'; |
14 | 14 |
15 var computedStyleMap = getComputedStyleMap(testElement); | 15 var computedStyleMap = getComputedStyleMap(testElement); |
16 | 16 |
17 test(function() { | 17 test(function() { |
18 var result = computedStyleMap.get('line-height'); | 18 var result = computedStyleMap.get('line-height'); |
19 assert_true(result instanceof CSSSimpleLength); | 19 assert_equals(result.constructor.name, CSSUnitValue.name); |
20 assert_equals(result.cssText, '10px'); | 20 assert_equals(result.cssText, '10px'); |
21 }, 'Getting a 10px lineHeight results in a CSSSimpleLength'); | 21 }, 'Getting a 10px lineHeight results in a CSSUnitValue'); |
22 | 22 |
23 test(function() { | 23 test(function() { |
24 testElement.style.lineHeight = '20px'; | 24 testElement.style.lineHeight = '20px'; |
25 var result = computedStyleMap.getAll('line-height'); | 25 var result = computedStyleMap.getAll('line-height'); |
26 assert_equals(result.length, 1); | 26 assert_equals(result.length, 1); |
27 assert_equals(result[0].cssText, '20px'); | 27 assert_equals(result[0].cssText, '20px'); |
28 }, 'getAll for lineHeight returns a single value'); | 28 }, 'getAll for lineHeight returns a single value'); |
29 | 29 |
30 test(function() { | 30 test(function() { |
31 testElement.style.lineHeight = '10%'; | 31 testElement.style.lineHeight = '10%'; |
32 var result = computedStyleMap.get('line-height'); | 32 var result = computedStyleMap.get('line-height'); |
33 assert_true(result instanceof CSSSimpleLength); | 33 assert_equals(result.constructor.name, CSSUnitValue.name); |
34 assert_equals(result.cssText, '10px'); | 34 assert_equals(result.cssText, '10px'); |
35 }, 'Getting a 10% lineHeight results in a CSSSimpleLength'); | 35 }, 'Getting a 10% lineHeight results in a CSSUnitValue'); |
36 | 36 |
37 test(function() { | 37 test(function() { |
38 testElement.style.lineHeight = '0.2'; | 38 testElement.style.lineHeight = '0.2'; |
39 var result = computedStyleMap.get('line-height'); | 39 var result = computedStyleMap.get('line-height'); |
40 assert_true(result instanceof CSSSimpleLength); | 40 assert_equals(result.constructor.name, CSSUnitValue.name); |
41 assert_equals(result.cssText, '20px'); | 41 assert_equals(result.cssText, '20px'); |
42 }, 'Getting a number lineHeight results in a CSSSimpleLength'); | 42 }, 'Getting a number lineHeight results in a CSSUnitValue'); |
43 | 43 |
44 test(function() { | 44 test(function() { |
45 testElement.style.lineHeight = 'calc(10px + 10%)'; | 45 testElement.style.lineHeight = 'calc(10px + 10%)'; |
46 var result = computedStyleMap.get('line-height'); | 46 var result = computedStyleMap.get('line-height'); |
47 assert_true(result instanceof CSSSimpleLength); | 47 assert_equals(result.constructor.name, CSSUnitValue.name); |
48 assert_equals(result.cssText, '20px'); | 48 assert_equals(result.cssText, '20px'); |
49 }, 'Getting a calc lineHeight results in a CSSSimpleLength'); | 49 }, 'Getting a calc lineHeight results in a CSSUnitValue'); |
50 | 50 |
51 test(function() { | 51 test(function() { |
52 testElement.style.lineHeight = 'normal'; | 52 testElement.style.lineHeight = 'normal'; |
53 var result = computedStyleMap.get('line-height'); | 53 var result = computedStyleMap.get('line-height'); |
54 assert_true(result instanceof CSSKeywordValue); | 54 assert_equals(result.constructor.name, CSSKeywordValue.name); |
55 assert_equals(result.cssText, 'normal'); | 55 assert_equals(result.cssText, 'normal'); |
56 }, 'Getting a normal lineHeight results in a CSSKeywordValue'); | 56 }, 'Getting a normal lineHeight results in a CSSKeywordValue'); |
57 | 57 |
58 </script> | 58 </script> |
59 </body> | 59 </body> |
60 </html> | 60 </html> |
OLD | NEW |