summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-values/calc-infinity-nan-serialize-length.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /testing/web-platform/tests/css/css-values/calc-infinity-nan-serialize-length.html
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-values/calc-infinity-nan-serialize-length.html')
-rw-r--r--testing/web-platform/tests/css/css-values/calc-infinity-nan-serialize-length.html67
1 files changed, 67 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-values/calc-infinity-nan-serialize-length.html b/testing/web-platform/tests/css/css-values/calc-infinity-nan-serialize-length.html
new file mode 100644
index 0000000000..96b4c43e2d
--- /dev/null
+++ b/testing/web-platform/tests/css/css-values/calc-infinity-nan-serialize-length.html
@@ -0,0 +1,67 @@
+<!DOCTYPE HTML>
+<title>Infinity and NaN: calc() serialization for length values.</title>
+<link rel="author" title="Seokho Song" href="mailto:0xdevssh@gmail.com">
+<link rel="help" href="https://drafts.csswg.org/css-values/#calc-type-checking">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../support/serialize-testcommon.js"></script>
+<div id="target"></div>
+<div id="log"></div>
+<script>
+function test_serialization(t,s, {prop="width"}={}) {
+ test_specified_serialization(prop, t, s)
+}
+//TEST CASE | EXPECTED
+var test_map = {
+ "1px * NaN" :"calc(NaN * 1px)",
+ "1% * NaN" :"calc(NaN * 1%)",
+ "1in * NaN" :"calc(NaN * 1px)",
+ "1cm * NaN" :"calc(NaN * 1px)",
+ "1mm * NaN" :"calc(NaN * 1px)",
+ "1q * NaN" :"calc(NaN * 1px)",
+ "1pt * NaN" :"calc(NaN * 1px)",
+ "1pc * NaN" :"calc(NaN * 1px)",
+ "1px * nan" :"calc(NaN * 1px)",
+ "1px * infinity / infinity" :"calc(NaN * 1px)",
+ "1px * 0 * infinity" :"calc(NaN * 1px)",
+ "1px * (infinity + -infinity)" :"calc(NaN * 1px)",
+ "1px * (-infinity + infinity)" :"calc(NaN * 1px)",
+ "1px * (infinity - infinity)" :"calc(NaN * 1px)",
+ "1px * infinity" :"calc(infinity * 1px)",
+ "1px * -infinity" :"calc(-infinity * 1px)",
+ "1% * infinity" :"calc(infinity * 1%)",
+ "1% * -infinity" :"calc(-infinity * 1%)",
+ "1px * iNFinIty" :"calc(infinity * 1px)",
+ "1px * (infinity + infinity)" :"calc(infinity * 1px)",
+ "1px * (-infinity + -infinity)" :"calc(-infinity * 1px)",
+ "1px * 1/infinity" :"calc(0px)",
+ "1px * infinity * infinity" :"calc(infinity * 1px)",
+ "1px * -infinity * -infinity" :"calc(infinity * 1px)",
+ "1 * max(INFinity*3px, 0px)" :"calc(infinity * 1px)",
+ "1 * min(inFInity*4px, 0px)" :"calc(0px)",
+ "1 * max(nAn*2px, 0px)" :"calc(NaN * 1px)",
+ "1 * min(nan*3px, 0px)" :"calc(NaN * 1px)",
+ "1 * clamp(-INFINITY*20px, 0px, infiniTY*10px)" :"calc(0px)",
+
+ "1px * max(NaN, min(0,10))" :"calc(NaN * 1px)",
+ "1px * clamp(NaN, 0, 10)" :"calc(NaN * 1px)",
+
+ "1px * max(0, min(10, NaN))" :"calc(NaN * 1px)",
+ "1px * clamp(0, 10, NaN)" :"calc(NaN * 1px)",
+
+ "1px * max(0, min(NaN, 10))" :"calc(NaN * 1px)",
+ "1px * clamp(0, NaN, 10)" :"calc(NaN * 1px)",
+
+ "1px * clamp(-Infinity, 0, infinity)" :"calc(0px)",
+ "1px * clamp(-inFinity, infinity, 10)" :"calc(10px)",
+
+ "1 * min(NaN * 1pt, NaN * 1cm)" :"calc(NaN * 1px)",
+ "1 * max(NaN * 1cm, NaN * 2Q)" :"calc(NaN * 1px)",
+ "1 * min(NaN * 2px, NaN * 4em)" :"min(NaN * 1px, NaN * 1em)",
+ "1 * clamp(NaN * 2em, NaN * 4px, NaN * 8pt)" :"clamp(NaN * 1em, NaN * 1px, NaN * 1px)",
+};
+
+for (var exp in test_map) {
+ test_serialization("calc("+exp+")", test_map[exp]);
+}
+</script> \ No newline at end of file