Parse font-display
[WebKit-https.git] / LayoutTests / fast / text / font-display / parse.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/js-test-pre.js"></script>
5 <style id="style">
6 @font-face {
7     font-family: "Test0";
8     src: local("Times");
9     font-display: garbage;
10 }
11 @font-face {
12     font-family: "Test1";
13     src: local("Times");
14 }
15 @font-face {
16     font-family: "Test2";
17     src: local("Times");
18     font-display: block swap;
19 }
20 @font-face {
21     font-family: "Test3";
22     src: local("Times");
23     font-display: auto;
24 }
25 @font-face {
26     font-family: "Test4";
27     src: local("Times");
28     font-display: block;
29 }
30 @font-face {
31     font-family: "Test5";
32     src: local("Times");
33     font-display: swap;
34 }
35 @font-face {
36     font-family: "Test6";
37     src: local("Times");
38     font-display: fallback;
39 }
40 @font-face {
41     font-family: "Test7";
42     src: local("Times");
43     font-display: optional;
44 }
45 @font-face {
46     font-family: "Test8";
47     src: local("Times");
48     font-display: ;
49 }
50 </style>
51 </head>
52 <body>
53 <div id="test9" style="font-display: block"></div>
54 <script>
55 description("This test makes sure that the font-display descriptor in @font-face is appropriately parsed.");
56
57 var sheet = document.getElementById("style").sheet;
58 shouldBeEqualToString("sheet.rules[0].style.getPropertyValue('font-display')", "");
59 shouldBeEqualToString("sheet.rules[1].style.getPropertyValue('font-display')", "");
60 shouldBeEqualToString("sheet.rules[2].style.getPropertyValue('font-display')", "");
61 shouldBeEqualToString("sheet.rules[3].style.getPropertyValue('font-display')", "auto");
62 shouldBeEqualToString("sheet.rules[4].style.getPropertyValue('font-display')", "block");
63 shouldBeEqualToString("sheet.rules[5].style.getPropertyValue('font-display')", "swap");
64 shouldBeEqualToString("sheet.rules[6].style.getPropertyValue('font-display')", "fallback");
65 shouldBeEqualToString("sheet.rules[7].style.getPropertyValue('font-display')", "optional");
66 shouldBeEqualToString("sheet.rules[8].style.getPropertyValue('font-display')", "");
67 shouldBeEqualToString("window.getComputedStyle(document.getElementById('test9')).getPropertyValue('font-display')", "");
68 </script>
69 <script src="../../../resources/js-test-post.js"></script>
70 </body>
71 </html>