Automatic update from web-platform-tests
Update random() with new syntax
Resolved in [0] and [1] to change random syntax to following:
<random()> = random( <random-cache-key>? , <calc-sum>, <calc-sum>,
<calc-sum>? )
<random-cache-key> = auto | <random-name> | fixed <number [0,1]>
<random-name> = <dashed-ident> [ element-scoped || [ property-scoped |
property-index-scoped ]]?
Previous syntax:
<random()> = random( <random-value-sharing>? , <calc-sum>, <calc-sum>,
<calc-sum>? )
<random-value-sharing> = [ [ auto | <dashed-ident> ] || element-shared ]
| fixed <number [0,1]>
Spec has not been fully updated yet.
[0] https://github.com/w3c/csswg-drafts/issues/13132#issuecomment-3998898114
[1] https://github.com/w3c/csswg-drafts/issues/13601#issuecomment-4171573718
Bug: 413385732
Change-Id: I30f355ef6241b3d0c8e259bc1044ba2f57ce2b97
Fixed: 498620677, 489743837
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7735052
Commit-Queue: Munira Tursunova <moonira@google.com>
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1612756}
--
wpt-commits: 30794ddd1660f5dfe791bbc660754fc8e7d224f1
wpt-pr: 59091
50 lines
1.6 KiB
HTML
50 lines
1.6 KiB
HTML
<!DOCTYPE html>
|
|
<title>CSS Values and Units Test: random() in at-rule descriptors</title>
|
|
<link rel="help" href="https://drafts.csswg.org/css-values-5/#random">
|
|
<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/10982">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="/css/css-conditional/container-queries/support/cq-testcommon.js"></script>
|
|
<style id="test_sheet">
|
|
@font-face {
|
|
font-family: my-font;
|
|
font-weight: 300;
|
|
font-weight: random(500, 900);
|
|
}
|
|
@font-face {
|
|
font-family: my-font;
|
|
font-stretch: 30%;
|
|
font-stretch: random(--foo element-scoped, 0%, 10%);
|
|
}
|
|
@font-palette-values --palette {
|
|
font-family: my-font;
|
|
base-palette: 3;
|
|
base-palette: random(10, 30);
|
|
}
|
|
@font-feature-values my-font {
|
|
@swash {
|
|
foo: random(1, 3);
|
|
}
|
|
}
|
|
</style>
|
|
<div id="test"></div>
|
|
<script>
|
|
const rules = test_sheet.sheet.cssRules;
|
|
test(() => {
|
|
assert_equals(rules[0].style.fontWeight, "300");
|
|
}, "random() should not be allowed in @font-face font-weight descriptor");
|
|
|
|
test(() => {
|
|
assert_equals(rules[1].style.fontStretch, "30%");
|
|
}, "element-scoped random() should not be allowed in @font-face font-stretch descriptor");
|
|
|
|
test(() => {
|
|
assert_equals(rules[2].basePalette, "3");
|
|
}, "random() should not be allowed in @font-palette-values base-palette descriptor, check total");
|
|
|
|
test(() => {
|
|
const swashValues = rules[3].swash.values();
|
|
assert_equals(swashValues.next().value, undefined);
|
|
}, "random() should not be allowed in @font-palette-values base-palette descriptor");
|
|
</script>
|