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

Side by Side Diff: third_party/WebKit/LayoutTests/intersection-observer/root-margin.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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 }, { rootMargin: "10px 20% 40% 30px" }); 47 }, { rootMargin: "10px 20% 40% 30px" });
48 observer.observe(target); 48 observer.observe(target);
49 entries = entries.concat(observer.takeRecords()); 49 entries = entries.concat(observer.takeRecords());
50 assert_equals(entries.length, 0, "No initial notifications."); 50 assert_equals(entries.length, 0, "No initial notifications.");
51 runTestCycle(step0, "First rAF."); 51 runTestCycle(step0, "First rAF.");
52 }, "Root margin tests"); 52 }, "Root margin tests");
53 53
54 function step0() { 54 function step0() {
55 document.scrollingElement.scrollLeft = 100; 55 document.scrollingElement.scrollLeft = 100;
56 runTestCycle(step1, "document.scrollingElement.scrollLeft = 100"); 56 runTestCycle(step1, "document.scrollingElement.scrollLeft = 100");
57 assert_equals(entries.length, 0, "No notifications after first rAF."); 57 checkLastEntry(entries, 0, [1012, 1112, 708, 808, 0, 0, 0, 0, -30, 942, -10, 8 19, target]);
58 } 58 }
59 59
60 function step1() { 60 function step1() {
61 document.scrollingElement.scrollTop = 800; 61 document.scrollingElement.scrollTop = 800;
62 runTestCycle(step2, "document.scrollingElement.scrollTop = 800"); 62 runTestCycle(step2, "document.scrollingElement.scrollTop = 800");
63 checkLastEntry(entries, 0, [912, 1012, 708, 808, 912, 942, 708, 808, -30, 942, -10, 819, target]); 63 checkLastEntry(entries, 1, [912, 1012, 708, 808, 912, 942, 708, 808, -30, 942, -10, 819, target]);
64 } 64 }
65 65
66 function step2() { 66 function step2() {
67 document.scrollingElement.scrollTop = 900; 67 document.scrollingElement.scrollTop = 900;
68 runTestCycle(step3, "document.scrollingElement.scrollTop = 900"); 68 runTestCycle(step3, "document.scrollingElement.scrollTop = 900");
69 checkLastEntry(entries, 0); 69 checkLastEntry(entries, 1);
70 } 70 }
71 71
72 function step3() { 72 function step3() {
73 document.scrollingElement.scrollLeft = 0; 73 document.scrollingElement.scrollLeft = 0;
74 document.scrollingElement.scrollTop = 0; 74 document.scrollingElement.scrollTop = 0;
75 checkLastEntry(entries, 1, [912, 1012, -192, -92, 0, 0, 0, 0, -30, 942, -10, 8 19, target]); 75 checkLastEntry(entries, 2, [912, 1012, -192, -92, 0, 0, 0, 0, -30, 942, -10, 8 19, target]);
76 } 76 }
77 </script> 77 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698