Skip to content

Commit d404737

Browse files
npm1moz-wptsync-bot
authored andcommitted
Bug 1689217 [wpt PR 27357] - [LayoutInstability] Add tests for invisible to visible, a=testonly
Automatic update from web-platform-tests [LayoutInstability] Add tests for invisible to visible This CL tests that there are not shifts reported when an element: * Changes from visibility:visible to hidden * Changes from Opacity 1 to 0 Relevant issue: WICG/layout-instability#61 Change-Id: I0174d37673f34ca3adeeb66b238d4c79edf62e45 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2653974 Reviewed-by: Steve Kobes <skobes@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Cr-Commit-Position: refs/heads/master@{#848520} -- wpt-commits: 2f23ceeb5c7b64abfce343e0f96c73c7c11e97ba wpt-pr: 27357
1 parent b5a8aaf commit d404737

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE html>
2+
<title>Layout Instability: opacity:0</title>
3+
<link rel="help" href="https://wicg.github.io/layout-instability/" />
4+
<div id="target" style="position: absolute; top: 0; width: 400px; height: 400px;">
5+
</div>
6+
<script src="/resources/testharness.js"></script>
7+
<script src="/resources/testharnessreport.js"></script>
8+
<script src="resources/util.js"></script>
9+
<script>
10+
11+
promise_test(async () => {
12+
const watcher = new ScoreWatcher;
13+
14+
// Wait for the initial render to complete.
15+
await waitForAnimationFrames(2);
16+
17+
// Shift target, for which no shift should be reported because it's not visible.
18+
target.style.top = '200px';
19+
target.style.opacity = 0;
20+
21+
await waitForAnimationFrames(2);
22+
assert_equals(watcher.score, 0);
23+
}, 'opacity non-zero to zero');
24+
25+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE html>
2+
<title>Layout Instability: visibility:hidden</title>
3+
<link rel="help" href="https://wicg.github.io/layout-instability/" />
4+
<div id="target" style="position: absolute; top: 0; width: 400px; height: 400px;"></div>
5+
<script src="/resources/testharness.js"></script>
6+
<script src="/resources/testharnessreport.js"></script>
7+
<script src="resources/util.js"></script>
8+
<script>
9+
10+
promise_test(async () => {
11+
const watcher = new ScoreWatcher;
12+
13+
// Wait for the initial render to complete.
14+
await waitForAnimationFrames(2);
15+
16+
// Shift target and make hidden at the same time. Should not be reported!
17+
document.querySelector("#target").style.top = '200px';
18+
document.querySelector("#target").style.visibility = 'hidden';
19+
20+
await waitForAnimationFrames(2);
21+
// No shift should be reported.
22+
assert_equals(watcher.score, 0);
23+
}, 'visible to hidden');
24+
25+
</script>

0 commit comments

Comments
 (0)