diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /layout/style/test/test_media_query_serialization.html | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/style/test/test_media_query_serialization.html')
-rw-r--r-- | layout/style/test/test_media_query_serialization.html | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/layout/style/test/test_media_query_serialization.html b/layout/style/test/test_media_query_serialization.html new file mode 100644 index 0000000000..ed82653db0 --- /dev/null +++ b/layout/style/test/test_media_query_serialization.html @@ -0,0 +1,53 @@ +<!DOCTYPE HTML> +<html> +<head> +<title>Test media query list serialization</title> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> +<style> + @media PrInT {} + @media screen, PrInT, SPEECH {} + + @media GARbAGE7 {} + @media AAAAA {} + @media ZZZZZ {} + + @media NotAValidMediaType_!000 {} + @media NotAValidMediaType_!000, AlsoInvalid!!!! {} + + @media PrInT, GARbAGE7, notAValidMediaType_!000 {} +</style> +<script type="application/javascript"> + +let expectedValues = [ + // Valid types + ["print", "Valid media types are ascii lowercased."], + ["screen, print, speech", "Media query lists with only valid types are ascii lowercased."], + + // Invalid types + ["garbage7", "Invalid media types are ascii lowercased."], + ["aaaaa", "Ascii conversion handles 'A' correctly."], + ["zzzzz", "Ascii conversion handles 'Z' correctly."], + + // Malformed types + ["not all", "Malformed media types are serialized to 'not all'."], + ["not all, not all", "Multiple malformed media types are each serialized to 'not all'."], + + // Mixes + ["print, garbage7, not all", "Media query lists with a mix of valid, invalid, and malformed types serialize " + + "as lowercase with malformed types changed to 'not all'."], +]; + +let sheet = document.styleSheets[1]; + +expectedValues.forEach(function (entry, index) { + let rule = sheet.cssRules[index]; + let serializedList = rule.media.mediaText; + is(serializedList, entry[0], entry[1]); +}); + +</script> +</head> +<body> +</body> +</html> |