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

Side by Side Diff: third_party/WebKit/LayoutTests/intersection-observer/unclipped-root.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 23 matching lines...) Expand all
34 target = document.getElementById("target"); 34 target = document.getElementById("target");
35 assert_true(!!target, "target exists"); 35 assert_true(!!target, "target exists");
36 var root = document.getElementById("root"); 36 var root = document.getElementById("root");
37 assert_true(!!root, "root exists"); 37 assert_true(!!root, "root exists");
38 var observer = new IntersectionObserver(function(changes) { 38 var observer = new IntersectionObserver(function(changes) {
39 entries = entries.concat(changes) 39 entries = entries.concat(changes)
40 }, {root: root}); 40 }, {root: root});
41 observer.observe(target); 41 observer.observe(target);
42 entries = entries.concat(observer.takeRecords()); 42 entries = entries.concat(observer.takeRecords());
43 assert_equals(entries.length, 0, "No initial notifications."); 43 assert_equals(entries.length, 0, "No initial notifications.");
44 runTestCycle(step0, "First rAF should not generate notifications."); 44 runTestCycle(step0, "First rAF.");
45 }, "Test that border bounding box is used to calculate intersection with a non-s crolling root."); 45 }, "Test that border bounding box is used to calculate intersection with a non-s crolling root.");
46 46
47 function step0() { 47 function step0() {
48 target.style.transform = "translateY(195px)"; 48 target.style.transform = "translateY(195px)";
49 runTestCycle(step1, "target.style.transform = 'translateY(195px)'"); 49 runTestCycle(step1, "target.style.transform = 'translateY(195px)'");
50 assert_equals(entries.length, 0, "No notifications after first rAF."); 50 checkLastEntry(entries, 0, [15, 115, 315, 415, 0, 0, 0, 0, 8, 182, 8, 222, tar get]);
51 } 51 }
52 52
53 function step1() { 53 function step1() {
54 target.style.transform = ""; 54 target.style.transform = "";
55 checkLastEntry(entries, 0, [15, 115, 210, 310, 15, 115, 210, 222, 8, 182, 8, 2 22, target]); 55 checkLastEntry(entries, 1, [15, 115, 210, 310, 15, 115, 210, 222, 8, 182, 8, 2 22, target]);
56 } 56 }
57 </script> 57 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698