Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(446)

Side by Side Diff: third_party/WebKit/LayoutTests/intersection-observer/zero-area-element-hidden.html

Issue 2645283008: IntersectionObserver: Always send an initial notification. (Closed)
Patch Set: Fix unit test Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script> 2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script> 3 <script src="../resources/testharnessreport.js"></script>
4 <script src="./resources/intersection-observer-test-utils.js"></script> 4 <script src="./resources/intersection-observer-test-utils.js"></script>
5 5
6 <style> 6 <style>
7 pre, #log { 7 pre, #log {
8 position: absolute; 8 position: absolute;
9 top: 0; 9 top: 0;
10 left: 200px; 10 left: 200px;
(...skipping 16 matching lines...) Expand all
27 assert_equals(window.innerHeight, 600, "Window must be 600 pixels high."); 27 assert_equals(window.innerHeight, 600, "Window must be 600 pixels high.");
28 28
29 var target = document.getElementById('target'); 29 var target = document.getElementById('target');
30 assert_true(!!target, "target exists"); 30 assert_true(!!target, "target exists");
31 var observer = new IntersectionObserver(function(changes) { 31 var observer = new IntersectionObserver(function(changes) {
32 entries = entries.concat(changes) 32 entries = entries.concat(changes)
33 }); 33 });
34 observer.observe(target); 34 observer.observe(target);
35 entries = entries.concat(observer.takeRecords()); 35 entries = entries.concat(observer.takeRecords());
36 assert_equals(entries.length, 0, "No initial notifications."); 36 assert_equals(entries.length, 0, "No initial notifications.");
37 runTestCycle(step0, "First rAF should not generate a notification."); 37 runTestCycle(step0, "First rAF.");
38 }, "No intersecting observations should be sent for a zero-area hidden target.") ; 38 }, "A zero-area hidden target should not be intersecting.");
39 39
40 function step0() { 40 function step0() {
41 assert_equals(entries.length, 0, "No notifications after first rAF."); 41 checkLastEntry(entries, 0, [8, 8, -1000, -1000, 0, 0, 0, 0, 0, 800, 0, 600, ta rget]);
42 } 42 }
43 </script> 43 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698