OLD | NEW |
1 function testElementStyle(propertyJS, propertyCSS, value) | 1 function testElementStyle(propertyJS, propertyCSS, value) |
2 { | 2 { |
3 shouldBe("e.style." + propertyJS, "'" + value + "'"); | 3 shouldBe("e.style." + propertyJS, "'" + value + "'"); |
4 shouldBe("e.style.getPropertyValue('" + propertyCSS + "')", "'" + value + "'
"); | 4 shouldBe("e.style.getPropertyValue('" + propertyCSS + "')", "'" + value + "'
"); |
5 } | 5 } |
6 | 6 |
7 function testComputedStyle(propertyJS, propertyCSS, value) | 7 function testComputedStyle(propertyJS, propertyCSS, value) |
8 { | 8 { |
9 computedStyle = window.getComputedStyle(e, null); | 9 computedStyle = window.getComputedStyle(e, null); |
10 shouldBe("computedStyle." + propertyJS, "'" + value + "'"); | 10 shouldBe("computedStyle." + propertyJS, "'" + value + "'"); |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 function invalidValueSettingTest(value, defaultValue) | 23 function invalidValueSettingTest(value, defaultValue) |
24 { | 24 { |
25 debug("Invalid value test - '" + value + "':"); | 25 debug("Invalid value test - '" + value + "':"); |
26 e.style.textIndent = value; | 26 e.style.textIndent = value; |
27 testElementStyle("textIndent", "text-indent", defaultValue); | 27 testElementStyle("textIndent", "text-indent", defaultValue); |
28 testComputedStyle("textIndent", "text-indent", defaultValue); | 28 testComputedStyle("textIndent", "text-indent", defaultValue); |
29 debug(''); | 29 debug(''); |
30 } | 30 } |
31 | 31 |
32 description("This tests check that text-indent parses properly the properties fr
om CSS3 Text."); | 32 description("This test checks that text-indent parses properly the properties fr
om CSS3 Text."); |
33 | 33 |
34 e = document.getElementById('test'); | 34 e = document.getElementById('test'); |
35 | 35 |
36 debug("Test the initial value:"); | 36 debug("Test the initial value:"); |
37 testComputedStyle("textIndent", "text-indent", '0px'); | 37 testComputedStyle("textIndent", "text-indent", '0px'); |
38 debug(''); | 38 debug(''); |
39 | 39 |
40 valueSettingTest('10em', '10em', '100px'); | 40 valueSettingTest('10em', '10em', '100px'); |
41 valueSettingTest('20ex', '20ex', '200px'); | 41 valueSettingTest('20ex', '20ex', '200px'); |
42 valueSettingTest('50%', '50%', '50%'); | 42 valueSettingTest('50%', '50%', '50%'); |
43 valueSettingTest('calc(10px + 20px)', 'calc(30px)', '30px'); | 43 valueSettingTest('calc(10px + 20px)', 'calc(30px)', '30px'); |
44 valueSettingTest('10em -webkit-each-line', '10em -webkit-each-line', '100px -web
kit-each-line'); | 44 valueSettingTest('10em each-line', '10em each-line', '100px each-line'); |
45 valueSettingTest('-webkit-each-line 10em', '10em -webkit-each-line', '100px -web
kit-each-line'); | 45 valueSettingTest('each-line 10em', '10em each-line', '100px each-line'); |
46 valueSettingTest('20ex -webkit-each-line', '20ex -webkit-each-line', '200px -web
kit-each-line'); | 46 valueSettingTest('20ex each-line', '20ex each-line', '200px each-line'); |
47 valueSettingTest('-webkit-each-line 20ex', '20ex -webkit-each-line', '200px -web
kit-each-line'); | 47 valueSettingTest('each-line 20ex', '20ex each-line', '200px each-line'); |
48 valueSettingTest('30% -webkit-each-line', '30% -webkit-each-line', '30% -webkit-
each-line'); | 48 valueSettingTest('30% each-line', '30% each-line', '30% each-line'); |
49 valueSettingTest('-webkit-each-line 30%', '30% -webkit-each-line', '30% -webkit-
each-line'); | 49 valueSettingTest('each-line 30%', '30% each-line', '30% each-line'); |
50 valueSettingTest('calc(10px + 20px) -webkit-each-line', 'calc(30px) -webkit-each
-line', '30px -webkit-each-line'); | 50 valueSettingTest('calc(10px + 20px) each-line', 'calc(30px) each-line', '30px ea
ch-line'); |
51 valueSettingTest('-webkit-each-line calc(10px + 20px)', 'calc(30px) -webkit-each
-line', '30px -webkit-each-line'); | 51 valueSettingTest('each-line calc(10px + 20px)', 'calc(30px) each-line', '30px ea
ch-line'); |
52 debug(''); | 52 debug(''); |
53 | 53 |
54 defaultValue = '0px' | 54 defaultValue = '0px' |
55 e.style.textIndent = defaultValue; | 55 e.style.textIndent = defaultValue; |
56 invalidValueSettingTest('10m', defaultValue); | 56 invalidValueSettingTest('10m', defaultValue); |
57 invalidValueSettingTest('10m -webkit-each-line', defaultValue); | 57 invalidValueSettingTest('10m each-line', defaultValue); |
58 invalidValueSettingTest('-webkit-each-line 10m', defaultValue); | 58 invalidValueSettingTest('each-line 10m', defaultValue); |
59 invalidValueSettingTest('10em 10em', defaultValue); | 59 invalidValueSettingTest('10em 10em', defaultValue); |
60 invalidValueSettingTest('-webkit-each-line', defaultValue); | 60 invalidValueSettingTest('each-line', defaultValue); |
61 invalidValueSettingTest('10em -webkit-each-line 10em', defaultValue); | 61 invalidValueSettingTest('10em each-line 10em', defaultValue); |
62 invalidValueSettingTest('-webkit-each-line 10em -webkit-each-line', defaultValue
); | 62 invalidValueSettingTest('each-line 10em each-line', defaultValue); |
OLD | NEW |