mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 17:55:07 +02:00
Tests: Synchronize imported tests with the WPT repository
This commit is contained in:
committed by
Alexander Kalenik
parent
11e5cd5048
commit
689dff3ee8
Notes:
github-actions[bot]
2025-06-22 21:52:43 +00:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/689dff3ee85 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5160
@@ -185,4 +185,41 @@
|
||||
assert_equals(getComputedStyle(inner1).zIndex, '1');
|
||||
assert_equals(getComputedStyle(inner2).zIndex, '1');
|
||||
}, 'Mutating the selectorText of outer rule invalidates inner rules');
|
||||
|
||||
// CSSNestedDeclarations
|
||||
test((t) => {
|
||||
const main = document.createElement('main');
|
||||
main.innerHTML = `
|
||||
<style id="main_ss">
|
||||
div {
|
||||
z-index: 1;
|
||||
&.test { foo:bar; }
|
||||
}
|
||||
</style>
|
||||
<div id="outer" class="test">
|
||||
</div>
|
||||
`;
|
||||
document.documentElement.append(main);
|
||||
t.add_cleanup(() => main.remove());
|
||||
assert_equals(getComputedStyle(outer).zIndex, '1');
|
||||
const main_ss = document.getElementById("main_ss").sheet;
|
||||
const rule = main_ss.cssRules[0];
|
||||
assert_equals(rule.cssRules.length, 1);
|
||||
rule.insertRule('z-index: 3;');
|
||||
assert_equals(rule.cssRules.length, 2);
|
||||
assert_equals(getComputedStyle(outer).zIndex, '3');
|
||||
|
||||
// Throw only when no valid declaration https://github.com/w3c/csswg-drafts/issues/10520
|
||||
assert_throws_dom('SyntaxError', () => { rule.insertRule('nothing-to-insert-because-invalid-property-should-throw: 2;'); });
|
||||
assert_equals(rule.cssRules.length, 2);
|
||||
|
||||
// Test the insertion of nested declarations inside grouping rule
|
||||
rule.insertRule('@media screen { a { color: blue; }}',2);
|
||||
assert_equals(rule.cssRules.length, 3);
|
||||
const mediaRule = rule.cssRules[2];
|
||||
mediaRule.insertRule('z-index: 3;');
|
||||
assert_equals(mediaRule.cssRules.length, 2);
|
||||
assert_throws_dom('SyntaxError', () => { mediaRule.insertRule('nothing-to-insert-because-invalid-property-should-throw: 2;'); });
|
||||
}, 'Manipulation of nested declarations through CSSOM');
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user