summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-page/parsing
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
commit0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch)
treea31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /testing/web-platform/tests/css/css-page/parsing
parentInitial commit. (diff)
downloadfirefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz
firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-page/parsing')
-rw-r--r--testing/web-platform/tests/css/css-page/parsing/page-computed.html15
-rw-r--r--testing/web-platform/tests/css/css-page/parsing/page-invalid.html13
-rw-r--r--testing/web-platform/tests/css/css-page/parsing/page-orientation-computed.tentative.html12
-rw-r--r--testing/web-platform/tests/css/css-page/parsing/page-orientation-invalid.tentative.html15
-rw-r--r--testing/web-platform/tests/css/css-page/parsing/page-valid.html11
-rw-r--r--testing/web-platform/tests/css/css-page/parsing/size-001.html63
6 files changed, 129 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-page/parsing/page-computed.html b/testing/web-platform/tests/css/css-page/parsing/page-computed.html
new file mode 100644
index 0000000000..0accba0574
--- /dev/null
+++ b/testing/web-platform/tests/css/css-page/parsing/page-computed.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
+<link rel="help" href="https://www.w3.org/TR/css-page-3/#using-named-pages">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/css/support/computed-testcommon.js"></script>
+<div id="target"></div>
+<script>
+ test_computed_value("page", "auto");
+ test_computed_value("page", "AUTO", "auto");
+ test_computed_value("page", "blablabla");
+ test_computed_value("page", "BLABLABLA");
+ test_computed_value("page", "table");
+ test_computed_value("page", "TABLE");
+</script>
diff --git a/testing/web-platform/tests/css/css-page/parsing/page-invalid.html b/testing/web-platform/tests/css/css-page/parsing/page-invalid.html
new file mode 100644
index 0000000000..2c373a7d7f
--- /dev/null
+++ b/testing/web-platform/tests/css/css-page/parsing/page-invalid.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
+<link rel="help" href="https://www.w3.org/TR/css-page-3/#using-named-pages">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/css/support/parsing-testcommon.js"></script>
+<script>
+ test_invalid_value("page", "not valid");
+ test_invalid_value("page", "not,valid");
+ test_invalid_value("page", "123px");
+ test_invalid_value("page", "calc(10%+1px)");
+ test_invalid_value("page", "default");
+</script>
diff --git a/testing/web-platform/tests/css/css-page/parsing/page-orientation-computed.tentative.html b/testing/web-platform/tests/css/css-page/parsing/page-orientation-computed.tentative.html
new file mode 100644
index 0000000000..c9dd155f8c
--- /dev/null
+++ b/testing/web-platform/tests/css/css-page/parsing/page-orientation-computed.tentative.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
+<link rel="help" href="https://drafts.csswg.org/css-page-3/#page-orientation-prop">
+<div id="elm" style="page-orientation:rotate-right;"></div>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+ test(()=> {
+ assert_equals(getComputedStyle(elm).pageOrientation, "");
+ }, "page-orientation is not a property (only a descriptor)");
+</script>
+
diff --git a/testing/web-platform/tests/css/css-page/parsing/page-orientation-invalid.tentative.html b/testing/web-platform/tests/css/css-page/parsing/page-orientation-invalid.tentative.html
new file mode 100644
index 0000000000..e89b1f0917
--- /dev/null
+++ b/testing/web-platform/tests/css/css-page/parsing/page-orientation-invalid.tentative.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
+<link rel="help" href="https://drafts.csswg.org/css-page-3/#page-orientation-prop">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/css/support/parsing-testcommon.js"></script>
+<script>
+ // page-orientation is not a property. test_invalid_value() tries to specify
+ // it on an element, and this should fail, even when using a valid
+ // value. page-orientation is only valid as a descriptor inside an @page rule.
+ test_invalid_value("page-orientation", "hotpink");
+ test_invalid_value("page-orientation", "upright");
+ test_invalid_value("page-orientation", "rotate-left");
+ test_invalid_value("page-orientation", "rotate-right");
+</script>
diff --git a/testing/web-platform/tests/css/css-page/parsing/page-valid.html b/testing/web-platform/tests/css/css-page/parsing/page-valid.html
new file mode 100644
index 0000000000..a4c31f5766
--- /dev/null
+++ b/testing/web-platform/tests/css/css-page/parsing/page-valid.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
+<link rel="help" href="https://www.w3.org/TR/css-page-3/#using-named-pages">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/css/support/parsing-testcommon.js"></script>
+<script>
+ test_valid_value("page", "auto");
+ test_valid_value("page", "table");
+ test_valid_value("page", "xyzabc");
+</script>
diff --git a/testing/web-platform/tests/css/css-page/parsing/size-001.html b/testing/web-platform/tests/css/css-page/parsing/size-001.html
new file mode 100644
index 0000000000..885a7b8530
--- /dev/null
+++ b/testing/web-platform/tests/css/css-page/parsing/size-001.html
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<link rel="author" title="Mozilla" href="https://mozilla.org">
+<link rel="help" href="https://drafts.csswg.org/css-page-3/#page-size-prop">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<style>
+@page{
+ size: 640px 480px;
+}
+@page{
+ size: 8.5in 11in;
+}
+@page{
+ size: A4;
+}
+@page{
+ size: 3in 10in;
+}
+@page{
+ size: jis-B5;
+}
+@page{
+ size: auto;
+}
+@page{
+ size: landscape;
+}
+@page{
+ size: letter portrait;
+}
+@page{
+ size: legal landscape;
+}
+</style>
+
+<script>
+'use strict';
+
+const expectedSizes = [
+ "640px 480px",
+ "8.5in 11in",
+ "a4",
+ "3in 10in",
+ "jis-b5",
+ "auto",
+ "landscape",
+ "letter",
+ "legal landscape"
+];
+const sizePrefix = "size: ";
+
+test(t => {
+ assert_equals(document.styleSheets.length, 1);
+ let styleSheet = document.styleSheets[0];
+ assert_equals(styleSheet.rules.length, expectedSizes.length);
+ for(let i = 0; i < expectedSizes.length; i++){
+ let cssText = styleSheet.cssRules[i].style.cssText;
+ assert_true(cssText.startsWith(sizePrefix));
+ cssText = cssText.slice(sizePrefix.length);
+ assert_equals(cssText, expectedSizes[i] + ";", "for rule " + i);
+ }
+}, "size-001");
+</script>