Skip to content

Commit

Permalink
Additional font-palette-values color-mix testcases.
Browse files Browse the repository at this point in the history
Add a couple of check for nested color-mix() usage.

Differential Revision: https://phabricator.services.mozilla.com/D208116

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1891700
gecko-commit: ca6bbe8eb5798b866f943d353b1cf7de5777b210
gecko-reviewers: firefox-style-system-reviewers, emilio
  • Loading branch information
jfkthame authored and moz-wptsync-bot committed May 15, 2024
1 parent d4bff26 commit 42fc384
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
14 changes: 13 additions & 1 deletion css/css-fonts/parsing/font-palette-values-invalid.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,18 @@
@font-palette-values --A {
override-colors: 0 light-dark(white, currentcolor);
}

/* 23 */
@font-palette-values --A {
override-colors: 0 color-mix(in lch, red, color-mix(in lch, currentcolor, black));
}
</style>
</head>
<body>
<script>
let rules = document.getElementById("style").sheet.cssRules;
test(function() {
assert_equals(rules.length, 23);
assert_equals(rules.length, 24);
});

test(function() {
Expand Down Expand Up @@ -331,6 +336,13 @@
assert_equals(text.indexOf("override-colors"), -1);
assert_equals(rule.overrideColors, "");
});

test(function() {
let text = rules[23].cssText;
let rule = rules[23];
assert_equals(text.indexOf("override-colors"), -1);
assert_equals(rule.overrideColors, "");
});
</script>
</body>
</html>
13 changes: 13 additions & 0 deletions css/css-fonts/parsing/font-palette-values-valid.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@
@font-palette-values --Q {
override-colors: 0 color-mix(in lch, red, blue);
}

/* 18 */
@font-palette-values --R {
override-colors: 0 color-mix(in lch, color-mix(in lch, red, blue), color-mix(in lch, green, white));
}
</style>
</head>
<body>
Expand Down Expand Up @@ -398,6 +403,14 @@
assert_equals(rule.basePalette, "");
assert_equals(rule.overrideColors, "0 color-mix(in lch, red, blue)");
});

test(function() {
let rule = rules[18];
assert_equals(rule.name, "--R");
assert_equals(rule.fontFamily, "");
assert_equals(rule.basePalette, "");
assert_equals(rule.overrideColors, "0 color-mix(in lch, color-mix(in lch, red, blue), color-mix(in lch, green, white))");
});
</script>
</body>
</html>

0 comments on commit 42fc384

Please sign in to comment.