Index: third_party/WebKit/LayoutTests/intersection-observer/zero-area-element-hidden.html |
diff --git a/third_party/WebKit/LayoutTests/intersection-observer/zero-area-element-hidden.html b/third_party/WebKit/LayoutTests/intersection-observer/zero-area-element-hidden.html |
index bf1d2f4c191b7ab79d97ec5cca95c7a7b2161826..d1946d1ee598039b6b26df9f8819aeaec0c97c8c 100644 |
--- a/third_party/WebKit/LayoutTests/intersection-observer/zero-area-element-hidden.html |
+++ b/third_party/WebKit/LayoutTests/intersection-observer/zero-area-element-hidden.html |
@@ -1,24 +1,43 @@ |
<!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 hidden zero-area element is treated correctly</title> |
+<style> |
+pre, #log { |
+ position: absolute; |
+ top: 0; |
+ left: 200px; |
+} |
+#target { |
+ width: 0px; |
+ height: 0px; |
+ position: fixed; |
+ top: -1000px; |
+} |
+</style> |
-<div id='target' style='width: 0px; height: 0px; position: fixed; top: -1000px'</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(() => { |
- // Since the element is initially assumed to be hidden, there are no entries. |
- assert_equals(entries.length, 0); |
- })); |
-}); |
+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 not generate a notification."); |
+}, "No intersecting observations should be sent for a zero-area hidden target."); |
+ |
+function step0() { |
+ assert_equals(entries.length, 0, "No notifications after first rAF."); |
+} |
</script> |