diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/css/css-view-transitions/only-child-new.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-view-transitions/only-child-new.html')
-rw-r--r-- | testing/web-platform/tests/css/css-view-transitions/only-child-new.html | 171 |
1 files changed, 171 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-view-transitions/only-child-new.html b/testing/web-platform/tests/css/css-view-transitions/only-child-new.html new file mode 100644 index 0000000000..9f36528219 --- /dev/null +++ b/testing/web-platform/tests/css/css-view-transitions/only-child-new.html @@ -0,0 +1,171 @@ +<!DOCTYPE html> +<html class="reftest-wait foo"> +<title>View transitions: ensure :only-child is supported on view-transition-new</title> +<link rel="help" href="https://github.com/WICG/view-transitions"> +<link rel="author" href="mailto:khushalsagar@chromium.org"> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<style> +::view-transition { + background-color: black; +} +html:only-child { + background-color: black; +} +:root:only-child { + background-color: black; +} +:only-child { + background-color: black; +} +.foo:only-child { + background-color: black; +} + +::view-transition-new(root) { + background-color: blue; +} +::view-transition-new(target) { + background-color: blue; +} +::view-transition-new(*) { + color: blue; +} + +::view-transition-new(root):only-child { + background-color: red; +} +::view-transition-new(target):only-child { + background-color: red; +} +::view-transition-new(*):only-child { + color: red; +} + +</style> +<div id="target"></div> + +<script> +let matchedColor = "rgb(255, 0, 0)"; +let notMatchedColor = "rgb(0, 0, 255)"; + +promise_test(() => { + assert_implements(document.startViewTransition, "Missing document.startViewTransition"); + return new Promise(async (resolve, reject) => { + document.documentElement.style.viewTransitionName = "none"; + target.style.viewTransitionName = "none"; + let transition = document.startViewTransition(() => { + document.documentElement.style.viewTransitionName = "root"; + }); + + transition.ready.then(() => { + let style = getComputedStyle( + document.documentElement, ":view-transition-new(root)"); + if (style.backgroundColor == matchedColor && style.color == matchedColor) + resolve(); + else + reject(style.backgroundColor + " and " + style.color); + }); + }); +}, ":only-child should match because ::view-transition-old is not generated (none to root)"); + +promise_test(() => { + assert_implements(document.startViewTransition, "Missing document.startViewTransition"); + return new Promise(async (resolve, reject) => { + document.documentElement.style.viewTransitionName = "root"; + target.style.viewTransitionName = "none"; + let transition = document.startViewTransition(); + + transition.ready.then(() => { + let style = getComputedStyle( + document.documentElement, ":view-transition-new(root)"); + if (style.backgroundColor == notMatchedColor && style.color == notMatchedColor) + resolve(); + else + reject(style.backgroundColor + " and " + style.color); + }); + }); +}, ":only-child should not match because ::view-transition-old is generated (root to root)"); + +promise_test(() => { + assert_implements(document.startViewTransition, "Missing document.startViewTransition"); + return new Promise(async (resolve, reject) => { + document.documentElement.style.viewTransitionName = "none"; + target.style.viewTransitionName = "root"; + let transition = document.startViewTransition(() => { + document.documentElement.style.viewTransitionName = "root"; + target.style.viewTransitionName = "none"; + }); + + transition.ready.then(() => { + let style = getComputedStyle( + document.documentElement, ":view-transition-new(root)"); + if (style.backgroundColor == notMatchedColor && style.color == notMatchedColor) + resolve(); + else + reject(style.backgroundColor + " and " + style.color); + }); + }); +}, ":only-child should not match because ::view-transition-old is generated (element to root)"); + +promise_test(() => { + assert_implements(document.startViewTransition, "Missing document.startViewTransition"); + return new Promise(async (resolve, reject) => { + target.style.viewTransitionName = "none"; + document.documentElement.style.viewTransitionName = "none"; + let transition = document.startViewTransition(() => { + target.style.viewTransitionName = "target"; + }); + + transition.ready.then(() => { + let style = getComputedStyle( + document.documentElement, ":view-transition-new(target)"); + if (style.backgroundColor == matchedColor && style.color == matchedColor) + resolve(); + else + reject(style.backgroundColor + " and " + style.color); + }); + }); +}, ":only-child should match because ::view-transition-old is not generated (none to element)"); + +promise_test(() => { + assert_implements(document.startViewTransition, "Missing document.startViewTransition"); + return new Promise(async (resolve, reject) => { + target.style.viewTransitionName = "none"; + document.documentElement.style.viewTransitionName = "root"; + let transition = document.startViewTransition(() => { + document.documentElement.style.viewTransitionName = "none"; + target.style.viewTransitionName = "element"; + }); + + transition.ready.then(() => { + let style = getComputedStyle( + document.documentElement, ":view-transition-new(root)"); + if (style.backgroundColor == notMatchedColor && style.color == notMatchedColor) + resolve(); + else + reject(style.backgroundColor + " and " + style.color); + }); + }); +}, ":only-child should not match because ::view-transition-old is generated (root to element)"); + +promise_test(() => { + assert_implements(document.startViewTransition, "Missing document.startViewTransition"); + return new Promise(async (resolve, reject) => { + target.style.viewTransitionName = "target"; + document.documentElement.style.viewTransitionName = "none"; + let transition = document.startViewTransition(); + + transition.ready.then(() => { + let style = getComputedStyle( + document.documentElement, ":view-transition-new(target)"); + if (style.backgroundColor == notMatchedColor && style.color == notMatchedColor) + resolve(); + else + reject(style.backgroundColor + " and " + style.color); + }); + }); +}, ":only-child should not match because ::view-transition-old is generated (element to element)"); +</script> |