tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 09e36a9586777a6f1407bf73fa1a7509b83a7e8d
parent 84d0e7f4683650e748bf6e5060202930b6bfbc5c
Author: Anders Hartvoll Ruud <andruud@chromium.org>
Date:   Mon, 27 Oct 2025 10:07:25 +0000

Bug 1996256 [wpt PR 55633] - [@mixin] Add WPT for child rule validity, a=testonly

Automatic update from web-platform-tests
[@mixin] Add WPT for child rule validity

For now, "mixins-parsing.html" only checks for validity of child rules,
but I'm planning to extend it with tests for preludes (etc)
in the future, hence the general name.

Bug: 406935599
Change-Id: Ibc46ec52398494d939e052f2912c9fb69a7084b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7080070
Reviewed-by: Steinar H Gunderson <sesse@chromium.org>
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1534890}

--

wpt-commits: 32b7826398052c37c81c2f85565f870732ed9173
wpt-pr: 55633

Diffstat:
Atesting/web-platform/tests/css/css-mixins/mixin-parsing.html | 42++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+), 0 deletions(-)

diff --git a/testing/web-platform/tests/css/css-mixins/mixin-parsing.html b/testing/web-platform/tests/css/css-mixins/mixin-parsing.html @@ -0,0 +1,42 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Mixins: Parsing</title> + <link rel="help" href="https://drafts.csswg.org/css-mixins-1/#defining-mixins"> + <link rel="help" href="https://github.com/w3c/csswg-drafts/issues/12417"> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + </head> + <body> + + <script> + function test_child(css, is_valid, description) { + test(() => { + let sheet = new CSSStyleSheet(); + sheet.replaceSync(css); + assert_equals(sheet.cssRules.length, 1, 'mixin is present'); // @mixin + assert_equals(sheet.cssRules[0].cssRules.length, (is_valid ? 1 : 0), 'child count'); + }, `${description} is ${is_valid ? 'valid' : 'invalid'} in @mixin`); + } + function test_valid_child(css, description) { + return test_child(css, /*is_valid=*/true, description); + } + function test_invalid_child(css, description) { + return test_child(css, /*is_valid=*/false, description); + } + + test_invalid_child('@mixin --m() { @layer bar; }', '@layer (statement)'); + test_invalid_child('@mixin --m() { @layer bar {} }', '@layer (block)'); + test_invalid_child('@mixin --m() { @layer {} }', '@layer (anonymous)'); + test_valid_child('@mixin --m() { div {} }', 'style rule'); + test_valid_child('@mixin --m() { > div {} }', 'style rule (relative)'); + test_valid_child('@mixin --m() { @media (width) {} }', '@media'); + test_valid_child('@mixin --m() { @supports (width:0) {} }', '@supports'); + test_valid_child('@mixin --m() { @container (width) {} }', '@container'); + test_valid_child('@mixin --m() { @starting-style {} }', '@starting-style'); + test_valid_child('@mixin --m() { @scope (.foo) {} }', '@scope'); + test_valid_child('@mixin --m() { @scope {} }', '@scope (implicit)'); + </script> + + </body> +</html>