Skip to content

Commit

Permalink
Add tests for not resolving colors in color-mix function
Browse files Browse the repository at this point in the history
From the discussion here:
w3c/csswg-drafts#7302

Keyword colors shouldn't be resolved as specified colors.

Bug: 1362022
Change-Id: I3e4f3dd7220ac84777a1edddd54f87ead217d6b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3945930
Commit-Queue: Juanmi Huertas <juanmihd@chromium.org>
Reviewed-by: Juanmi Huertas <juanmihd@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1066591}
  • Loading branch information
mysteryDate authored and chromium-wpt-export-bot committed Nov 2, 2022
1 parent 7e858f7 commit a9e3973
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions css/css-color/parsing/color-valid-color-mix-function.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@
<body>
<div id="target"></div>
<script>
// https://github.com/w3c/csswg-drafts/issues/7302: Specified values shouldn't resolve keyword colors or calc values
test_valid_value(`color`, `color-mix(in srgb, red, blue)`, `color-mix(in srgb, red, blue)`);
test_valid_value(`color`, `color-mix(in hsl, red, blue)`, `color-mix(in hsl, red, blue)`);
test_valid_value(`color`, `color-mix(in hsl, red calc(20%), blue)`, `color-mix(in hsl, red calc(20%), blue)`);
test_valid_value(`color`, `color-mix(in hsl, red calc(var(--v)*1%), blue)`, `color-mix(in hsl, red calc(var(--v)*1%), blue)`);
test_valid_value(`color`, `color-mix(in hsl, currentcolor, blue)`, `color-mix(in hsl, currentcolor, blue)`);
test_valid_value(`color`, `color-mix(in hsl, red 60%, blue 40%)`, `color-mix(in hsl, red 60%, blue 40%)`);
test_valid_value(`color`, `color-mix(in lch decreasing hue, red, hsl(120, 100%, 50%))`, `color-mix(in lch decreasing hue, red, rgb(0, 255, 0))`);

test_valid_value(`color`, `color-mix(in hsl, hsl(120deg 10% 20%), hsl(30deg 30% 40%))`, `color-mix(in hsl, rgb(46, 56, 46), rgb(133, 102, 71))`);
test_valid_value(`color`, `color-mix(in hsl, hsl(120deg 10% 20%) 25%, hsl(30deg 30% 40%))`, `color-mix(in hsl, rgb(46, 56, 46) 25%, rgb(133, 102, 71))`);
test_valid_value(`color`, `color-mix(in hsl, 25% hsl(120deg 10% 20%), hsl(30deg 30% 40%))`, `color-mix(in hsl, rgb(46, 56, 46) 25%, rgb(133, 102, 71))`);
Expand Down

0 comments on commit a9e3973

Please sign in to comment.