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

Side by Side Diff: third_party/WebKit/LayoutTests/intersection-observer/resources/intersection-observer-test-utils.js

Issue 2662993002: [IntersectionObserver] Add isIntersecting field. (Closed)
Patch Set: webexposed 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 // Here's how waitForNotification works: 1 // Here's how waitForNotification works:
2 // 2 //
3 // - myTestFunction0() 3 // - myTestFunction0()
4 // - waitForNotification(myTestFunction1) 4 // - waitForNotification(myTestFunction1)
5 // - requestAnimationFrame() 5 // - requestAnimationFrame()
6 // - Modify DOM in a way that should trigger an IntersectionObserver callback. 6 // - Modify DOM in a way that should trigger an IntersectionObserver callback.
7 // - BeginFrame 7 // - BeginFrame
8 // - requestAnimationFrame handler runs 8 // - requestAnimationFrame handler runs
9 // - First setTimeout() 9 // - First setTimeout()
10 // - Style, layout, paint 10 // - Style, layout, paint
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 if (expected) { 79 if (expected) {
80 checkRect( 80 checkRect(
81 entries[i].boundingClientRect, expected.slice(0, 4), 81 entries[i].boundingClientRect, expected.slice(0, 4),
82 'entries[' + i + '].boundingClientRect'); 82 'entries[' + i + '].boundingClientRect');
83 checkRect( 83 checkRect(
84 entries[i].intersectionRect, expected.slice(4, 8), 84 entries[i].intersectionRect, expected.slice(4, 8),
85 'entries[' + i + '].intersectionRect'); 85 'entries[' + i + '].intersectionRect');
86 checkRect( 86 checkRect(
87 entries[i].rootBounds, expected.slice(8, 12), 87 entries[i].rootBounds, expected.slice(8, 12),
88 'entries[' + i + '].rootBounds'); 88 'entries[' + i + '].rootBounds');
89 if (expected.length > 12) {
90 assert_equals(
91 entries[i].isIntersecting, expected[12],
92 'entries[' + i + '].isIntersecting');
93 }
89 } 94 }
90 } 95 }
91 96
92 function checkJsonEntry(actual, expected) { 97 function checkJsonEntry(actual, expected) {
93 checkRect( 98 checkRect(
94 actual.boundingClientRect, expected.boundingClientRect, 99 actual.boundingClientRect, expected.boundingClientRect,
95 'entry.boundingClientRect'); 100 'entry.boundingClientRect');
96 checkRect( 101 checkRect(
97 actual.intersectionRect, expected.intersectionRect, 102 actual.intersectionRect, expected.intersectionRect,
98 'entry.intersectionRect'); 103 'entry.intersectionRect');
99 if (actual.rootBounds == 'null') 104 if (actual.rootBounds == 'null')
100 assert_equals(expected.rootBounds, 'null', 'rootBounds is null'); 105 assert_equals(expected.rootBounds, 'null', 'rootBounds is null');
101 else 106 else
102 checkRect(actual.rootBounds, expected.rootBounds, 'entry.rootBounds'); 107 checkRect(actual.rootBounds, expected.rootBounds, 'entry.rootBounds');
103 assert_equals(actual.target, expected.target); 108 assert_equals(actual.target, expected.target);
104 } 109 }
105 110
106 function checkJsonEntries(actual, expected, description) { 111 function checkJsonEntries(actual, expected, description) {
107 test(function() { 112 test(function() {
108 assert_equals(actual.length, expected.length); 113 assert_equals(actual.length, expected.length);
109 for (var i = 0; i < actual.length; i++) 114 for (var i = 0; i < actual.length; i++)
110 checkJsonEntry(actual[i], expected[i]); 115 checkJsonEntry(actual[i], expected[i]);
111 }, description); 116 }, description);
112 } 117 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698