Bug 1839315: part 4) Link from `SheetLoadData::mWasAlternate` to spec. r=emilio DONTBUILD
[gecko.git] / layout / style / test / test_media_query_serialization.html
blobed82653db0a730551b799854f7c13dc09efc7253
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <title>Test media query list serialization</title>
5 <script src="/tests/SimpleTest/SimpleTest.js"></script>
6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
7 <style>
8 @media PrInT {}
9 @media screen, PrInT, SPEECH {}
11 @media GARbAGE7 {}
12 @media AAAAA {}
13 @media ZZZZZ {}
15 @media NotAValidMediaType_!000 {}
16 @media NotAValidMediaType_!000, AlsoInvalid!!!! {}
18 @media PrInT, GARbAGE7, notAValidMediaType_!000 {}
19 </style>
20 <script type="application/javascript">
22 let expectedValues = [
23 // Valid types
24 ["print", "Valid media types are ascii lowercased."],
25 ["screen, print, speech", "Media query lists with only valid types are ascii lowercased."],
27 // Invalid types
28 ["garbage7", "Invalid media types are ascii lowercased."],
29 ["aaaaa", "Ascii conversion handles 'A' correctly."],
30 ["zzzzz", "Ascii conversion handles 'Z' correctly."],
32 // Malformed types
33 ["not all", "Malformed media types are serialized to 'not all'."],
34 ["not all, not all", "Multiple malformed media types are each serialized to 'not all'."],
36 // Mixes
37 ["print, garbage7, not all", "Media query lists with a mix of valid, invalid, and malformed types serialize " +
38 "as lowercase with malformed types changed to 'not all'."],
41 let sheet = document.styleSheets[1];
43 expectedValues.forEach(function (entry, index) {
44 let rule = sheet.cssRules[index];
45 let serializedList = rule.media.mediaText;
46 is(serializedList, entry[0], entry[1]);
47 });
49 </script>
50 </head>
51 <body>
52 </body>
53 </html>