Bug 1710945 [wpt PR 28980] - Extend CSS module test coverage, a=testonly
[gecko.git] / testing / web-platform / tests / html / semantics / scripting-1 / the-script-element / css-module / charset.html
blob8b72481814b1f320dfb56d5299d1988455d32b44
1 <!DOCTYPE html>
2 <meta charset=utf-8>
3 <title>CSS modules: UTF-8 decoding</title>
4 <script src="/resources/testharness.js"></script>
5 <script src="/resources/testharnessreport.js"></script>
6 <div id=log></div>
7 <script type="module" onerror="unreachable()">
8 import styleSheet from "../serve-with-content-type.py?fn=css-module/resources/utf-8.css&ct=text/css%3Bcharset=utf-8" assert { type: "css"};
9 test(() => {
10 assert_equals(styleSheet.rules[0].style.content, "\"śćążź\"");
11 }, "CSS module should be loaded as utf-8 when charset=utf8 is specified");
12 </script>
13 <script type="module" onerror="unreachable()">
14 import styleSheet from "../serve-with-content-type.py?fn=css-module/resources/utf-8.css&ct=text/css%3Bcharset=shift-jis" assert { type: "css"};
15 test(() => {
16 assert_equals(styleSheet.rules[0].style.content, "\"śćążź\"");
17 }, "CSS module should be loaded as utf-8 when charset=shift-jis is specified");
18 </script>
19 <script type="module" onerror="unreachable()">
20 import styleSheet from "../serve-with-content-type.py?fn=css-module/resources/utf-8.css&ct=text/css%3Bcharset=windows-1252" assert { type: "css"};
21 test(() => {
22 assert_equals(styleSheet.rules[0].style.content, "\"śćążź\"");
23 }, "CSS module should be loaded as utf-8 when charset=windows-1252 is specified");
24 </script>
25 <script type="module" onerror="unreachable()">
26 import styleSheet from "../serve-with-content-type.py?fn=css-module/resources/utf-8.css&ct=text/css%3Bcharset=utf-7" assert { type: "css"};;
27 test(() => {
28 assert_equals(styleSheet.rules[0].style.content, "\"śćążź\"");
29 }, "CSS module should be loaded as utf-8 when charset=utf-7 is specified");
30 </script>
31 <script type="module" onerror="unreachable()">
32 import styleSheet from "../serve-with-content-type.py?fn=css-module/resources/windows-1250.css&ct=text/css%3Bcharset=windows-1250" assert { type: "css"};
33 test(() => {
34 assert_not_equals(styleSheet.rules[0].style.content, "\"śćążź\"",
35 'Should be decoded as UTF-8');
36 }, "CSS module should be loaded as utf-8 even if it is encoded in windows-1250 and served with a windows-1250 charset response header");
37 </script>