summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-values/calc-catch-divide-by-0.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/css/css-values/calc-catch-divide-by-0.html
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-values/calc-catch-divide-by-0.html')
-rw-r--r--testing/web-platform/tests/css/css-values/calc-catch-divide-by-0.html47
1 files changed, 47 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-values/calc-catch-divide-by-0.html b/testing/web-platform/tests/css/css-values/calc-catch-divide-by-0.html
new file mode 100644
index 0000000000..ed5dbc90e4
--- /dev/null
+++ b/testing/web-platform/tests/css/css-values/calc-catch-divide-by-0.html
@@ -0,0 +1,47 @@
+<!DOCTYPE HTML>
+<title>Zero Division: calc() serialization.</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 = {
+ "100px * 0 / 0" :"calc(NaN * 1px)",
+ "100px / 0" :"calc(infinity * 1px)",
+ "100px / (0)" :"calc(infinity * 1px)",
+ "100px / (2 - 2)" :"calc(infinity * 1px)",
+ "100px / (2 - (-62 + 64))" :"calc(infinity * 1px)",
+ "100px * (1 / 0)" :"calc(infinity * 1px)",
+ "100px * (1 / (0))" :"calc(infinity * 1px)",
+ "100px * (1 / (2 - 2))" :"calc(infinity * 1px)",
+ "100px * (1 / (2 - (-62 + 64)))" :"calc(infinity * 1px)",
+ "1px * max(1/0, 0)" :"calc(infinity * 1px)",
+ "1px * min(1/0, 0)" :"calc(0px)",
+ "1px * max(0/0, 0)" :"calc(NaN * 1px)",
+ "1px * min(0/0, 0)" :"calc(NaN * 1px)",
+
+ "1px * max(0/0, min(0,10))" :"calc(NaN * 1px)",
+ "1px * clamp(0/0, 0, 10)" :"calc(NaN * 1px)",
+
+ "1px * max(0, min(10, 0/0))" :"calc(NaN * 1px)",
+ "1px * clamp(0, 10, 0/0)" :"calc(NaN * 1px)",
+
+ "1px * max(0, min(0/0, 10))" :"calc(NaN * 1px)",
+ "1px * clamp(0, 0/0, 10)" :"calc(NaN * 1px)",
+
+ "1px * clamp(-1/0, 0, 1/0)" :"calc(0px)",
+ "1px * clamp(-1/0, 1/0, 10)" :"calc(10px)",
+};
+for (var exp in test_map) {
+ test_serialization("calc("+exp+")", test_map[exp])
+}
+
+</script> \ No newline at end of file