diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /testing/web-platform/tests/css/cssom/CSSGroupingRule-cssRules.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/cssom/CSSGroupingRule-cssRules.html')
-rw-r--r-- | testing/web-platform/tests/css/cssom/CSSGroupingRule-cssRules.html | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/cssom/CSSGroupingRule-cssRules.html b/testing/web-platform/tests/css/cssom/CSSGroupingRule-cssRules.html new file mode 100644 index 0000000000..e4afd5e560 --- /dev/null +++ b/testing/web-platform/tests/css/cssom/CSSGroupingRule-cssRules.html @@ -0,0 +1,54 @@ +<!doctype html> +<html> +<head> + <meta charset="utf-8"> + <title>CSSOM - CSSGroupingRule - cssRules</title> + <link rel="help" href="https://drafts.csswg.org/cssom/#the-cssgroupingrule-interface"> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script> + function create(t) { + var style = document.createElement('style'); + style.appendChild(document.createTextNode('@media all { * {} }')); + document.head.appendChild(style); + t.add_cleanup(function() { + document.head.removeChild(style); + }); + + assert_true(!!style.sheet, 'setup - sheet defined'); + assert_equals( + style.sheet.cssRules.length, 1, 'setup - grouping rule created' + ); + assert_equals( + style.sheet.cssRules[0].cssRules.length, 1, 'setup - rule created' + ); + return style.sheet.cssRules[0]; + } + + test(function (t) { + var groupingRule = create(t); + groupingRule.cssRules.wptMarker = 'wpt'; + + // `insertRule` is used to prompt non-conforming implementations to + // create a new CSSRuleList object. Its behavior is verified by a + // dedicated test and should not influence the result of this + // particular test. + try { + groupingRule.insertRule('.foo {}', 0); + groupingRule.insertRule('.bar {}', 0); + groupingRule.insertRule('.baz {}', 0); + } catch (err) {} + + assert_equals(groupingRule.cssRules.wptMarker, 'wpt'); + + try { + groupingRule.deleteRule('.foo {}', 0); + groupingRule.deleteRule('.bar {}', 0); + groupingRule.deleteRule('.baz {}', 0); + } catch (err) {} + + assert_equals(groupingRule.cssRules.wptMarker, 'wpt'); + }, '[SameObject] is honored'); + </script> +</head> +</html> |