Skip to content

Commit

Permalink
Test parse-time HSL clamp of negative saturation to zero (#44269)
Browse files Browse the repository at this point in the history
  • Loading branch information
svgeesus authored Feb 14, 2024
1 parent 92cff38 commit 2736c7f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions css/css-color/parsing/color-valid-hsl.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
test_valid_value("color", "hsl(120 30 none / 0.5)", "rgba(0, 0, 0, 0.5)");
test_valid_value("color", "hsl(120 30 50 / none)", "rgba(89, 166, 89, 0)");

// Test parse-time clamp of negative saturation to zero
test_valid_value("color", "hsl(0 -50% 40%)", "rgb(102, 102, 102)");
test_valid_value("color", "hsl(30 -50% 60)", "rgb(153, 153, 153)");
test_valid_value("color", "hsl(0 -50 40%)", "rgb(102, 102, 102)");
test_valid_value("color", "hsl(30 -50 60)", "rgb(153, 153, 153)");

// Test non-finite values. calc(infinity) goes to upper bound while calc(-infinity) and NaN go to the lower bound.
// See: https://github.com/w3c/csswg-drafts/issues/8629
test_valid_value("color", "hsl(calc(infinity) 100% 50%)", "rgb(255, 0, 0)"); // hsl(360 100% 50%)
Expand Down

0 comments on commit 2736c7f

Please sign in to comment.