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 <script> | 4 <script> |
5 | 5 |
6 var tests = [ | 6 var tests = [ |
7 ['border: 1px; border-top: 1px;', 'border: 1px;'], | 7 ['border: 1px; border-top: 1px;', 'border: 1px;'], |
8 ['border: 1px solid red;', 'border: 1px solid red;'], | 8 ['border: 1px solid red;', 'border: 1px solid red;'], |
9 ['border: 1px red;', 'border: 1px red;'], | 9 ['border: 1px red;', 'border: 1px red;'], |
10 ['border: red;', 'border: red;'], | 10 ['border: red;', 'border: red;'], |
(...skipping 10 matching lines...) Expand all Loading... |
21 ['border-width: 1px;', 'border-width: 1px;'], | 21 ['border-width: 1px;', 'border-width: 1px;'], |
22 | 22 |
23 ['-webkit-border-horizontal-spacing: 1px; -webkit-border-vertical-spacing: 2
px;', 'border-spacing: 1px 2px;'], | 23 ['-webkit-border-horizontal-spacing: 1px; -webkit-border-vertical-spacing: 2
px;', 'border-spacing: 1px 2px;'], |
24 | 24 |
25 // We don't use shorthand for font-family, etc... for compatibility reasons | 25 // We don't use shorthand for font-family, etc... for compatibility reasons |
26 ['font-family: sans-serif; line-height: 2em; font-size: 3em; font-style: ita
lic; font-weight: bold;', | 26 ['font-family: sans-serif; line-height: 2em; font-size: 3em; font-style: ita
lic; font-weight: bold;', |
27 'font-family: sans-serif; line-height: 2em; font-size: 3em; font-style:
italic; font-weight: bold;'], | 27 'font-family: sans-serif; line-height: 2em; font-size: 3em; font-style:
italic; font-weight: bold;'], |
28 | 28 |
29 ['list-style-type: circle; list-style-position: inside; list-style-image: in
itial;', 'list-style: circle inside;'], | 29 ['list-style-type: circle; list-style-position: inside; list-style-image: in
itial;', 'list-style: circle inside;'], |
30 ['margin-top: 1px; margin-right: 2px; margin-bottom: 3px; margin-left: 4px;'
, 'margin: 1px 2px 3px 4px;'], | 30 ['margin-top: 1px; margin-right: 2px; margin-bottom: 3px; margin-left: 4px;'
, 'margin: 1px 2px 3px 4px;'], |
| 31 ['margin: 1px 2px; margin-top: var(--x);', 'margin-right: 2px; margin-bottom
: 1px; margin-left: 2px; margin-top: var(--x);'], |
31 ['outline-width: 2px; outline-style: dotted; outline-color: blue;', 'outline
: blue dotted 2px;'], | 32 ['outline-width: 2px; outline-style: dotted; outline-color: blue;', 'outline
: blue dotted 2px;'], |
32 ['overflow-x: scroll; overflow-y: hidden;', 'overflow-x: scroll; overflow-y:
hidden;'], | 33 ['overflow-x: scroll; overflow-y: hidden;', 'overflow-x: scroll; overflow-y:
hidden;'], |
33 ['overflow-x: scroll; overflow-y: scroll;', 'overflow: scroll;'], | 34 ['overflow-x: scroll; overflow-y: scroll;', 'overflow: scroll;'], |
34 ['padding-top: 1px; padding-right: 2px; padding-bottom: 3px; padding-left: 4
px;', 'padding: 1px 2px 3px 4px;'], | 35 ['padding-top: 1px; padding-right: 2px; padding-bottom: 3px; padding-left: 4
px;', 'padding: 1px 2px 3px 4px;'], |
35 ['padding: initial; padding-top: initial !important', | 36 ['padding: initial; padding-top: initial !important', |
36 'padding-top: initial !important; padding-right: initial; padding-bottom
: initial; padding-left: initial;'], | 37 'padding-top: initial !important; padding-right: initial; padding-bottom
: initial; padding-left: initial;'], |
37 | 38 |
38 ['list-style-type: lower-alpha;', 'list-style-type: lower-alpha;'] | 39 ['list-style-type: lower-alpha;', 'list-style-type: lower-alpha;'] |
39 ]; | 40 ]; |
40 | 41 |
41 function normalizeCssText(text) { return text.trim().split(/;\s*/).sort().slice(
1).join("; "); } | 42 function normalizeCssText(text) { return text.trim().split(/;\s*/).sort().slice(
1).join("; "); } |
42 | 43 |
43 var element; | 44 var element; |
44 tests.forEach(function (values) { | 45 tests.forEach(function (values) { |
45 var styleAttribute = values[0]; | 46 var styleAttribute = values[0]; |
46 var expectedCssText = values[1]; | 47 var expectedCssText = values[1]; |
47 test(function() { | 48 test(function() { |
48 | 49 |
49 element = document.createElement('div'); | 50 element = document.createElement('div'); |
50 element.setAttribute('style', styleAttribute); | 51 element.setAttribute('style', styleAttribute); |
51 | 52 |
52 assert_equals(normalizeCssText(element.style.cssText), normalizeCssText(
expectedCssText)); | 53 assert_equals(normalizeCssText(element.style.cssText), normalizeCssText(
expectedCssText)); |
53 }, "cssText set to " + JSON.stringify(styleAttribute) + " is read back as "
+ JSON.stringify(expectedCssText)); | 54 }, "cssText set to " + JSON.stringify(styleAttribute) + " is read back as "
+ JSON.stringify(expectedCssText)); |
54 }); | 55 }); |
55 | 56 |
56 </script> | 57 </script> |
OLD | NEW |