blob: 877c2ba4b34615c41a5b21dbf114df69eef04352 [file] [log] [blame]
Xianzhu Wang3a36f4a2020-11-05 18:21:551<!DOCTYPE html>
2<title>Layout Instability: movement of fixed position</title>
3<link rel="help" href="https://wicg.github.io/layout-instability/" />
4<script src="/resources/testharness.js"></script>
5<script src="/resources/testharnessreport.js"></script>
6<script src="resources/util.js"></script>
7<div id="target" style="position: fixed; top: 100px; width: 300px; height: 200px; background: yellow">
8</div>
9<script>
10promise_test(async () => {
11 const watcher = new ScoreWatcher;
12
13 // Wait for the initial render to complete.
14 await waitForAnimationFrames(2);
15
16 // Modify the position of the div.
17 target.style.top = '200px';
18
19 const expectedScore = computeExpectedScore(300 * (200 + 100), 100);
20
21 // Observer fires after the frame is painted.
22 assert_equals(watcher.score, 0);
23 await watcher.promise;
24 assert_equals(watcher.score, expectedScore);
25}, 'Movement of fixed position');
26
27</script>