OLD | NEW |
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 27 matching lines...) Expand all Loading... |
38 }); | 38 }); |
39 observer.observe(target); | 39 observer.observe(target); |
40 entries = entries.concat(observer.takeRecords()); | 40 entries = entries.concat(observer.takeRecords()); |
41 assert_equals(entries.length, 0, "No initial notifications."); | 41 assert_equals(entries.length, 0, "No initial notifications."); |
42 runTestCycle(step0, "First rAF"); | 42 runTestCycle(step0, "First rAF"); |
43 }, "Observing a zero-area target."); | 43 }, "Observing a zero-area target."); |
44 | 44 |
45 function step0() { | 45 function step0() { |
46 document.scrollingElement.scrollTop = 300; | 46 document.scrollingElement.scrollTop = 300; |
47 runTestCycle(step1, "document.scrollingElement.scrollTop = 300"); | 47 runTestCycle(step1, "document.scrollingElement.scrollTop = 300"); |
48 assert_equals(entries.length, 0, "No notifications after first rAF."); | 48 checkLastEntry(entries, 0, [8, 8, 708, 708, 0, 0, 0, 0, 0, 785, 0, 600, target
]); |
49 } | 49 } |
50 | 50 |
51 function step1() { | 51 function step1() { |
52 document.scrollingElement.scrollTop = 100; | 52 document.scrollingElement.scrollTop = 100; |
53 runTestCycle(step2, "document.scrollingElement.scrollTop = 100"); | 53 runTestCycle(step2, "document.scrollingElement.scrollTop = 100"); |
54 checkLastEntry(entries, 0, [8, 8, 408, 408, 8, 8, 408, 408, 0, 785, 0, 600, ta
rget]); | 54 checkLastEntry(entries, 1, [8, 8, 408, 408, 8, 8, 408, 408, 0, 785, 0, 600, ta
rget]); |
55 } | 55 } |
56 | 56 |
57 function step2() { | 57 function step2() { |
58 document.scrollingElement.scrollTop = 0; | 58 document.scrollingElement.scrollTop = 0; |
59 checkLastEntry(entries, 1, [8, 8, 608, 608, 0, 0, 0, 0, 0, 785, 0, 600, target
]); | 59 checkLastEntry(entries, 2, [8, 8, 608, 608, 0, 0, 0, 0, 0, 785, 0, 600, target
]); |
60 } | 60 } |
61 </script> | 61 </script> |
OLD | NEW |