3 <link rel=
"author" title=
"Xidorn Quan" href=
"https://www.upsuper.org">
4 <script src=
"/resources/testharness.js"></script>
5 <script src=
"/resources/testharnessreport.js"></script>
7 <div id=
"display"></div>
9 // This cannot be a web-platform test because this doesn't match what
10 // the spec says at the moment. Specifically, the spec wants to have
11 // all font family serialized to string, while in practice, all browsers
12 // serialize simple them to identifiers in some cases.
13 // We want to check our current behavior. This can be changed once
14 // browsers have an agreement on the exact behavior to spec.
16 // format: [input, expected serialization]
20 [' simple ', 'simple'],
21 ['multi idents font', 'multi idents font'],
22 [' multi idents font ', 'multi idents font'],
23 ['"wrapped name"', '"wrapped name"'],
24 ['" wrapped name "', '" wrapped name "'],
26 // Special whitespaces
27 ['\\ leading ws', '" leading ws"'],
28 [' \\ leading ws', '" leading ws"'],
29 ['\\ \\ leading ws', '" leading ws"'],
30 [' \\ \\ leading ws', '" leading ws"'],
31 ['\\ \\ \\ leading ws', '" leading ws"'],
32 ['trailing ws\\ ', '"trailing ws "'],
33 ['trailing ws\\ ', '"trailing ws "'],
34 ['trailing ws \\ ', '"trailing ws "'],
35 ['trailing ws\\ \\ ', '"trailing ws "'],
36 ['escaped\\ ws', '"escaped ws"'],
37 ['escaped\\ ws', '"escaped ws"'],
38 ['escaped\\ \\ ws', '"escaped ws"'],
39 ['escaped \\ ws', '"escaped ws"'],
40 ['escaped \\ ws', '"escaped ws"'],
41 ['escaped number\\ 5', '"escaped number 5"'],
44 let el
= document
.getElementById("display");
45 for (let [input
, expected
] of tests
) {
47 el
.style
.fontFamily
= input
;
48 assert_equals(el
.style
.fontFamily
, expected
);
49 }, "Reserialization for " + JSON
.stringify(input
));