Automatic update from web-platform-tests Convert CLS source attribution integration tests to WPT. Bug: 1053510 Change-Id: Ia1549ffa6d0c5d3e6f3dbdca79c83e4a66304852 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2189951 Commit-Queue: Steve Kobes <skobes@chromium.org> Reviewed-by: Nicolás Peña Moreno <npm@chromium.org> Cr-Commit-Position: refs/heads/master@{#766956} -- wpt-commits: d0b09af9c467a2fa00dd84ec1d85037ee70a4fb3 wpt-pr: 23483
33 lines
1.0 KiB
HTML
33 lines
1.0 KiB
HTML
<!DOCTYPE html>
|
|
<title>Layout Instability: simple block movement is detected</title>
|
|
<link rel="help" href="https://wicg.github.io/layout-instability/" />
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="resources/test-adapter.js"></script>
|
|
<script src="resources/util.js"></script>
|
|
<style>
|
|
#shifter { position: relative; width: 300px; height: 200px; }
|
|
</style>
|
|
<div id="shifter"></div>
|
|
<script>
|
|
|
|
promise_test(async () => {
|
|
const watcher = new ScoreWatcher;
|
|
|
|
// Wait for the initial render to complete.
|
|
await waitForAnimationFrames(2);
|
|
|
|
// Modify the position of the div.
|
|
document.querySelector("#shifter").style = "top: 160px";
|
|
|
|
// An element of size (300 x 200) has shifted by 160px.
|
|
const expectedScore = computeExpectedScore(300 * (200 + 160), 160);
|
|
|
|
// Observer fires after the frame is painted.
|
|
cls_expect(watcher, {score: 0});
|
|
await watcher.promise;
|
|
cls_expect(watcher, {score: expectedScore});
|
|
}, 'Simple block movement.');
|
|
|
|
</script>
|