diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
commit | 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /testing/web-platform/tests/css/css-page/page-rule-declarations-001.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-page/page-rule-declarations-001.html')
-rw-r--r-- | testing/web-platform/tests/css/css-page/page-rule-declarations-001.html | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-page/page-rule-declarations-001.html b/testing/web-platform/tests/css/css-page/page-rule-declarations-001.html new file mode 100644 index 0000000000..dc225b5abd --- /dev/null +++ b/testing/web-platform/tests/css/css-page/page-rule-declarations-001.html @@ -0,0 +1,57 @@ +<!doctype html> +<meta charset="utf-8"> +<title>CSS Paged Media: parsing @page declarations inside @media</title> +<link rel="author" title="Felipe Erias Morandeira" href="mailto:felipeerias@gmail.com"/> +<link rel="help" href="https://drafts.csswg.org/css-page/#at-page-rule"/> +<meta name="assert" content="Test that @page declarations inside @media are parsed correctly."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<style type="text/css"> + + @media print { + @page { + margin: 3cm; + } + @page :first { + margin-top: 6cm; + } + @page :left { + color: red; + } + @page :right { + color: blue; + } + } + +</style> +<script type="text/javascript"> + + let expectedForSelector = { + "" : "margin: 3cm;", + ":first" : "margin-top: 6cm;", + ":left" : "color: red;", + ":right" : "color: blue;" + }; + let styleSheets = document.styleSheets; + for (let i = 0; i < styleSheets.length; i++) { + let rules = styleSheets[i].cssRules; + for (let rule of rules) { + if (rule.type == CSSRule.MEDIA_RULE && rule.conditionText == 'print') { + for (let mediaRule of rule.cssRules) { + if (mediaRule.type == CSSRule.PAGE_RULE) { + let expected = expectedForSelector[mediaRule.selectorText]; + test(function(){ + assert_equals(mediaRule.style.cssText, expected, "unexpected @page contents"); + }, "unexpected contents for selector ['" + mediaRule.selectorText + "']"); + delete expectedForSelector[mediaRule.selectorText]; + } + } + } + } + } + test(function() { + assert_equals(Object.keys(expectedForSelector).length, 0, "missing @page selectors in @media"); + }); + +</script> |