| Index: third_party/WebKit/LayoutTests/intersection-observer/zero-area-element-visible.html
|
| diff --git a/third_party/WebKit/LayoutTests/intersection-observer/zero-area-element-visible.html b/third_party/WebKit/LayoutTests/intersection-observer/zero-area-element-visible.html
|
| index 1bc785f2ab7a99b2ea69ffbb0a1b04b127aa4f0b..8e70e624143020c833670a2aa546dcb6041872e9 100644
|
| --- a/third_party/WebKit/LayoutTests/intersection-observer/zero-area-element-visible.html
|
| +++ b/third_party/WebKit/LayoutTests/intersection-observer/zero-area-element-visible.html
|
| @@ -1,24 +1,42 @@
|
| <!DOCTYPE html>
|
| -<script src="../resources/intersection-observer-helper-functions.js"></script>
|
| <script src="../resources/testharness.js"></script>
|
| <script src="../resources/testharnessreport.js"></script>
|
| +<script src="./resources/intersection-observer-test-utils.js"></script>
|
|
|
| -<title>Ensure that a visible zero-area element is given the correct intersection ratio</title>
|
| +<style>
|
| +pre, #log {
|
| + position: absolute;
|
| + top: 0;
|
| + left: 200px;
|
| +}
|
| +#target {
|
| + width: 0px;
|
| + height: 0px;
|
| +}
|
| +</style>
|
|
|
| -<div id='target' style='width: 0px; height: 0px'</div>"
|
| +<div id='target'></div>
|
|
|
| <script>
|
| -'use strict';
|
| +var entries = [];
|
|
|
| -async_test(t => {
|
| - let target = document.getElementById('target');
|
| - let entries = [];
|
| - new IntersectionObserver(changes => {
|
| - entries.push(...changes);
|
| - }).observe(target);
|
| - waitForNotification(t.step_func_done(() => {
|
| - assert_equals(entries.length, 1);
|
| - assert_equals(entries[0].intersectionRatio, 1);
|
| - }));
|
| -});
|
| +runTestCycle(function() {
|
| + assert_equals(window.innerWidth, 800, "Window must be 800 pixels wide.");
|
| + assert_equals(window.innerHeight, 600, "Window must be 600 pixels high.");
|
| +
|
| + var target = document.getElementById('target');
|
| + assert_true(!!target, "target exists");
|
| + var observer = new IntersectionObserver(function(changes) {
|
| + entries = entries.concat(changes)
|
| + });
|
| + observer.observe(target);
|
| + entries = entries.concat(observer.takeRecords());
|
| + assert_equals(entries.length, 0, "No initial notifications.");
|
| + runTestCycle(step0, "First rAF should generate a notification.");
|
| +}, "Ensure that a zero-area target intersecting root generates a notification with intersectionRatio == 1");
|
| +
|
| +function step0() {
|
| + assert_equals(entries.length, 1, "One notification.");
|
| + assert_equals(entries[0].intersectionRatio, 1, "intersectionRatio == 1");
|
| +}
|
| </script>
|
|
|