summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/scroll-animations/css/scroll-timeline-shorthand.tentative.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/scroll-animations/css/scroll-timeline-shorthand.tentative.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/scroll-animations/css/scroll-timeline-shorthand.tentative.html')
-rw-r--r--testing/web-platform/tests/scroll-animations/css/scroll-timeline-shorthand.tentative.html122
1 files changed, 122 insertions, 0 deletions
diff --git a/testing/web-platform/tests/scroll-animations/css/scroll-timeline-shorthand.tentative.html b/testing/web-platform/tests/scroll-animations/css/scroll-timeline-shorthand.tentative.html
new file mode 100644
index 0000000000..68e1cc955f
--- /dev/null
+++ b/testing/web-platform/tests/scroll-animations/css/scroll-timeline-shorthand.tentative.html
@@ -0,0 +1,122 @@
+<!DOCTYPE html>
+<link rel="help" href="https://drafts.csswg.org/scroll-animations-1/#scroll-timeline-shorthand">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/css/support/computed-testcommon.js"></script>
+<script src="/css/support/parsing-testcommon.js"></script>
+<script src="/css/support/shorthand-testcommon.js"></script>
+<div id="target"></div>
+<script>
+test_valid_value('scroll-timeline', 'none block', 'none');
+test_valid_value('scroll-timeline', 'none inline');
+test_valid_value('scroll-timeline', 'abc horizontal');
+test_valid_value('scroll-timeline', 'abc inline');
+test_valid_value('scroll-timeline', 'aBc inline');
+test_valid_value('scroll-timeline', 'inline inline');
+test_valid_value('scroll-timeline', 'abc');
+
+test_valid_value('scroll-timeline', 'inline block', 'inline');
+test_valid_value('scroll-timeline', 'block block', 'block');
+test_valid_value('scroll-timeline', 'vertical block', 'vertical');
+test_valid_value('scroll-timeline', 'horizontal block', 'horizontal');
+
+test_valid_value('scroll-timeline', 'a, b, c');
+test_valid_value('scroll-timeline', 'a inline, b block, c vertical', 'a inline, b, c vertical');
+test_valid_value('scroll-timeline', 'auto');
+test_valid_value('scroll-timeline', 'abc defer vertical', 'abc vertical defer');
+test_valid_value('scroll-timeline', 'abc vertical defer');
+
+test_invalid_value('scroll-timeline', '');
+test_invalid_value('scroll-timeline', 'abc abc');
+test_invalid_value('scroll-timeline', 'block none');
+test_invalid_value('scroll-timeline', 'inline abc');
+test_invalid_value('scroll-timeline', 'default');
+test_invalid_value('scroll-timeline', ',');
+test_invalid_value('scroll-timeline', ',,block,,');
+
+test_computed_value('scroll-timeline', 'none block', 'none');
+test_computed_value('scroll-timeline', 'abc inline');
+test_computed_value('scroll-timeline', 'none vertical');
+test_computed_value('scroll-timeline', 'abc horizontal');
+test_computed_value('scroll-timeline', 'vertical vertical');
+test_computed_value('scroll-timeline', 'abc');
+test_computed_value('scroll-timeline', 'inline block', 'inline');
+test_computed_value('scroll-timeline', 'block block', 'block');
+test_computed_value('scroll-timeline', 'vertical block', 'vertical');
+test_computed_value('scroll-timeline', 'horizontal block', 'horizontal');
+test_computed_value('scroll-timeline', 'a, b, c');
+test_computed_value('scroll-timeline', 'a inline, b block, c vertical', 'a inline, b, c vertical');
+test_computed_value('scroll-timeline', 'abc defer vertical', 'abc vertical defer');
+test_computed_value('scroll-timeline', 'abc vertical defer');
+
+test_shorthand_value('scroll-timeline', 'abc vertical local',
+{
+ 'scroll-timeline-name': 'abc',
+ 'scroll-timeline-axis': 'vertical',
+ 'scroll-timeline-attachment': 'local',
+});
+test_shorthand_value('scroll-timeline', 'inline horizontal defer',
+{
+ 'scroll-timeline-name': 'inline',
+ 'scroll-timeline-axis': 'horizontal',
+ 'scroll-timeline-attachment': 'defer',
+});
+test_shorthand_value('scroll-timeline', 'abc vertical ancestor, def',
+{
+ 'scroll-timeline-name': 'abc, def',
+ 'scroll-timeline-axis': 'vertical, block',
+ 'scroll-timeline-attachment': 'ancestor, local',
+});
+test_shorthand_value('scroll-timeline', 'abc, def',
+{
+ 'scroll-timeline-name': 'abc, def',
+ 'scroll-timeline-axis': 'block, block',
+ 'scroll-timeline-attachment': 'local, local',
+});
+
+function test_shorthand_contraction(shorthand, longhands, expected) {
+ let longhands_fmt = Object.entries(longhands).map((e) => `${e[0]}:${e[1]}:${e[2]}`).join(';');
+ test((t) => {
+ t.add_cleanup(() => {
+ for (let shorthand of Object.keys(longhands))
+ target.style.removeProperty(shorthand);
+ });
+ for (let [shorthand, value] of Object.entries(longhands))
+ target.style.setProperty(shorthand, value);
+ assert_equals(target.style.getPropertyValue(shorthand), expected, 'Declared value');
+ assert_equals(getComputedStyle(target).getPropertyValue(shorthand), expected, 'Computed value');
+ }, `Shorthand contraction of ${longhands_fmt}`);
+}
+
+test_shorthand_contraction('scroll-timeline', {
+ 'scroll-timeline-name': 'abc',
+ 'scroll-timeline-axis': 'inline',
+ 'scroll-timeline-attachment': 'defer',
+}, 'abc inline defer');
+
+test_shorthand_contraction('scroll-timeline', {
+ 'scroll-timeline-name': 'a, b',
+ 'scroll-timeline-axis': 'inline, block',
+ 'scroll-timeline-attachment': 'ancestor, local',
+}, 'a inline ancestor, b');
+
+test_shorthand_contraction('scroll-timeline', {
+ 'scroll-timeline-name': 'none, none',
+ 'scroll-timeline-axis': 'block, block',
+ 'scroll-timeline-attachment': 'local, local',
+}, 'none, none');
+
+// Longhands with different lengths:
+
+test_shorthand_contraction('scroll-timeline', {
+ 'scroll-timeline-name': 'a, b, c',
+ 'scroll-timeline-axis': 'inline, inline',
+ 'scroll-timeline-attachment': 'local, local',
+}, '');
+
+test_shorthand_contraction('scroll-timeline', {
+ 'scroll-timeline-name': 'a, b',
+ 'scroll-timeline-axis': 'inline, inline, inline',
+ 'scroll-timeline-attachment': 'local, local',
+}, '');
+</script>