Skip to content

Commit b3958a2

Browse files
committed
Add tests for animating CSS ::backdrop pseudo-element
1 parent db40f3a commit b3958a2

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<meta charset="utf-8">
3+
<dialog id="target">Dialog contents</dialog>
4+
<style>
5+
#target::backdrop {
6+
opacity: 0.1;
7+
background-color: green;
8+
}
9+
</style>
10+
<script>
11+
const target = document.getElementById("target");
12+
target.showModal();
13+
</script>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<meta charset="utf-8">
3+
<title>CSS Test: A Web Animations on ::backdrop</title>
4+
<link rel="help" href="https://fullscreen.spec.whatwg.org/#::backdrop-pseudo-element">
5+
<link rel="match" href="backdrop-animate-002-ref.html">
6+
<dialog id="target">Dialog contents</dialog>
7+
<script>
8+
const target = document.getElementById("target");
9+
target.showModal();
10+
target.animate({
11+
opacity: [0.1, 0.1],
12+
backgroundColor: ["green", "green"]
13+
}, {
14+
pseudoElement: "::backdrop",
15+
duration: Infinity
16+
});
17+
</script>

css/css-pseudo/backdrop-animate.html

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!DOCTYPE html>
2+
<meta charset="utf-8">
3+
<title>CSS Pseudo-Elements Test: ::backdrop & web animations</title>
4+
<link rel="help" href="https://fullscreen.spec.whatwg.org/#::backdrop-pseudo-element">
5+
<link rel="help" href="https://drafts.csswg.org/web-animations-1/">
6+
<meta name="assert" content="This test checks that ::backdrop can be animated with Web Animations." />
7+
<div id="log"></div>
8+
<dialog id="target">Dialog contents</dialog>
9+
<script src="/resources/testharness.js"></script>
10+
<script src="/resources/testharnessreport.js"></script>
11+
<script>
12+
const target = document.getElementById("target");
13+
target.showModal();
14+
15+
test(function() {
16+
const options = {
17+
pseudoElement: "::backdrop",
18+
duration: 2,
19+
delay: -1,
20+
};
21+
const cs = getComputedStyle(target, "::backdrop");
22+
const anim = target.animate([
23+
{backgroundColor: "rgb(0, 100, 200)"},
24+
{backgroundColor: "rgb(200, 0, 100)"},
25+
], options);
26+
this.add_cleanup(() => anim.cancel());
27+
assert_equals(cs.backgroundColor, "rgb(100, 50, 150)", "background-color");
28+
}, "'backgroundColor' animation");
29+
</script>

0 commit comments

Comments
 (0)