Skip to content

Commit

Permalink
[css-properties-values-api] Split some of the registerProperty tests …
Browse files Browse the repository at this point in the history
…about sign() with mixed lengths.

Closes web-platform-tests/interop#911
  • Loading branch information
emilio committed Dec 20, 2024
1 parent 7e0d8b2 commit 3f44436
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE HTML>
<meta charset="utf-8">
<link rel="help" href="https://drafts.css-houdini.org/css-properties-values-api/#dom-css-registerproperty" />
<link rel="help" href="https://drafts.css-houdini.org/css-properties-values-api/#supported-syntax-strings" />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./resources/utils.js"></script>
<script>

let assert_valid = test_initial_value_valid;
let assert_invalid = test_initial_value_invalid;

assert_valid("<length>", "calc(15px + (sign(100vh - 10px) * 5px))");
assert_valid("<number>", "calc(15 + (sign(100vh - 10px) * 5))");
assert_valid("<integer>", "calc(15 + (sign(100vh - 10px) * 5))");
assert_valid("<angle>", "calc(15deg + (sign(100vh - 10px) * 5deg))");
assert_valid("<time>", "calc(15s + (sign(100vh - 10px) * 5s))");
assert_valid("<resolution>", "calc(15dppx + (sign(100vh - 10px) * 5dpi))");

</script>
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
assert_valid("<length>", "calc(2px*4 + 10px)");
assert_valid("<length>", "7.1e-4cm");
assert_valid("<length>", "calc(7in - 12px)");
assert_valid("<length>", "calc(15px + (sign(100vh - 10px) * 5px))");
assert_valid("<length>+", "2px 7px calc(8px)");
assert_valid("<length>#", "2px, 7px, calc(8px)");
assert_valid("<percentage>", "-9.3e3%");
Expand All @@ -49,25 +48,20 @@
assert_valid("<number>", "-109");
assert_valid("<number>", "2.3e4");
assert_valid("<number>", "calc(1 / 2)");
assert_valid("<number>", "calc(15 + (sign(100vh - 10px) * 5))");
assert_valid("<integer>", "-109");
assert_valid("<integer>", "19");
assert_valid("<integer>", "calc(1)");
assert_valid("<integer>", "calc(1 + 2)");
assert_valid("<integer>", "calc(3.1415)");
assert_valid("<integer>", "calc(3.1415 + 3.1415)");
assert_valid("<integer>", "calc(15 + (sign(100vh - 10px) * 5))");

assert_valid("<angle>", "10deg");
assert_valid("<angle>", "20.5rad");
assert_valid("<angle>", "calc(50grad + 3.14159rad)");
assert_valid("<angle>", "calc(15deg + (sign(100vh - 10px) * 5deg))");
assert_valid("<time>", "2s");
assert_valid("<time>", "calc(2s - 9ms)");
assert_valid("<time>", "calc(15s + (sign(100vh - 10px) * 5s))");
assert_valid("<resolution>", "10dpi");
assert_valid("<resolution>", "3dPpX");
assert_valid("<resolution>", "calc(15dppx + (sign(100vh - 10px) * 5dpi))");
assert_valid("<transform-function>", "translateX(2px)");
assert_valid("<transform-function>|<integer>", "5");
assert_valid("<transform-function>|<integer>", "scale(2)");
Expand Down

0 comments on commit 3f44436

Please sign in to comment.