5 <title>Test parsing of text-decoration shorthands
</title>
6 <script src=
"/resources/testharness.js"></script>
7 <script src=
"/resources/testharnessreport.js"></script>
8 <link rel='stylesheet' href='/resources/testharness.css'
>
14 var initial_values
= {
15 textDecorationColor
: "rgb(255, 0, 255)",
16 textDecorationLine
: "none",
17 textDecorationStyle
: "solid",
18 textDecorationThickness
: "auto",
21 // For various specified values of the text-decoration shorthand,
22 // test the computed values of the corresponding longhands.
23 var text_decoration_test_cases
= [
29 textDecorationColor
: "rgb(255, 0, 0)",
32 specified
: "line-through",
33 textDecorationLine
: "line-through",
37 textDecorationStyle
: "dotted",
41 textDecorationThickness
: "20px",
45 textDecorationThickness
: "auto",
48 specified
: "#00ff00 underline",
49 textDecorationColor
: "rgb(0, 255, 0)",
50 textDecorationLine
: "underline",
53 specified
: "#ffff00 wavy",
54 textDecorationColor
: "rgb(255, 255, 0)",
55 textDecorationStyle
: "wavy",
58 specified
: "overline double",
59 textDecorationLine
: "overline",
60 textDecorationStyle
: "double",
63 specified
: "red underline solid",
64 textDecorationColor
: "rgb(255, 0, 0)",
65 textDecorationLine
: "underline",
66 textDecorationStyle
: "solid",
69 specified
: "double overline blue",
70 textDecorationColor
: "rgb(0, 0, 255)",
71 textDecorationLine
: "overline",
72 textDecorationStyle
: "double",
75 specified
: "solid underline 10px",
76 textDecorationStyle
: "solid",
77 textDecorationLine
: "underline",
78 textDecorationThickness
: "10px",
81 specified
: "line-through blue 200px",
82 textDecorationLine
: "line-through",
83 textDecorationColor
: "rgb(0, 0, 255)",
84 textDecorationThickness
: "200px",
87 specified
: "underline wavy red 0",
88 textDecorationLine
: "underline",
89 textDecorationStyle
: "wavy",
90 textDecorationColor
: "rgb(255, 0, 0)",
91 textDecorationThickness
: "0px",
94 specified
: "overline -30px",
95 textDecorationLine
: "overline",
96 textDecorationThickness
: "-30px",
100 function run_tests(test_cases
, shorthand
, subproperties
) {
101 test_cases
.forEach(function(test_case
) {
103 var element
= document
.createElement('div');
104 document
.body
.appendChild(element
);
105 // Set text color to test initial value of text-decoration-color
107 element
.style
.color
= "#ff00ff";
108 element
.style
[shorthand
] = test_case
.specified
;
109 var computed
= window
.getComputedStyle(element
);
110 subproperties
.forEach(function(longhand
) {
113 test_case
[longhand
] || initial_values
[longhand
],
117 }, "test parsing of 'text-decoration: " + test_case
.specified
+ "'");
121 run_tests(text_decoration_test_cases
, "textDecoration", [
122 "textDecorationColor", "textDecorationLine", "textDecorationStyle", "textDecorationThickness"]);