diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/css/cssom/CSSGroupingRule-cssRules.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
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> |