forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathanimating.html
More file actions
55 lines (52 loc) · 1.62 KB
/
animating.html
File metadata and controls
55 lines (52 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<!DOCTYPE html>
<meta name="viewport" content="width=device-width,initial-scale=1">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./resources/intersection-observer-test-utils.js"></script>
<style>
pre, #log {
position: absolute;
top: 0;
left: 200px;
}
#target {
width: 100px;
height: 100px;
background-color: lightblue;
will-change: transform;
}
@keyframes slideup {
0% { transform: translateY(0) }
50% { transform: translateY(0) }
51% { transform: translateY(-2000px) }
100% { transform: translateY(-2000px) }
}
</style>
<div id="target"></div>
<script>
promise_test(t => {
return new Promise(async function(resolve, reject) {
let entries = [];
let target = document.getElementById("target");
let observer = new IntersectionObserver(function(changes) {
entries = entries.concat(changes);
assert_true(entries[0].isIntersecting);
changes.forEach(entry => {
if (!entry.isIntersecting) {
resolve("Received not-intersecting notification before animationend.");
}
});
});
target.style.animation = "4s linear slideup";
setTimeout(() => {
reject("Did not get a not-intersecting notification within 3 seconds.");
}, 3000);
target.addEventListener("animationend", evt => {
reject("animationend event fired before not-intersecting notification.");
});
await new Promise(resolve => setTimeout(resolve, 500));
observer.observe(target);
});
}, "IntersectionObserver generates notifications when "
+ "a transform animation changes intersection state");
</script>