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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 }, {root: root}); | 50 }, {root: root}); |
51 observer.observe(target); | 51 observer.observe(target); |
52 entries = entries.concat(observer.takeRecords()); | 52 entries = entries.concat(observer.takeRecords()); |
53 assert_equals(entries.length, 0, "No initial notifications."); | 53 assert_equals(entries.length, 0, "No initial notifications."); |
54 runTestCycle(step0, "First rAF"); | 54 runTestCycle(step0, "First rAF"); |
55 }, "Verify that not-intersecting notifications are sent when a target is removed
from the DOM tree."); | 55 }, "Verify that not-intersecting notifications are sent when a target is removed
from the DOM tree."); |
56 | 56 |
57 function step0() { | 57 function step0() { |
58 root.scrollTop = 150; | 58 root.scrollTop = 150; |
59 runTestCycle(step1, "root.scrollTop = 150"); | 59 runTestCycle(step1, "root.scrollTop = 150"); |
60 assert_equals(entries.length, 0, "No notifications after first rAF."); | 60 checkLastEntry(entries, 0, [11, 111, 311, 411, 0, 0, 0, 0, 11, 111, 11, 211, t
arget]); |
61 } | 61 } |
62 | 62 |
63 function step1() { | 63 function step1() { |
64 root.removeChild(target); | 64 root.removeChild(target); |
65 runTestCycle(step2, "root.removeChild(target)."); | 65 runTestCycle(step2, "root.removeChild(target)."); |
66 checkLastEntry(entries, 0, [11, 111, 161, 261, 11, 111, 161, 211, 11, 111, 11,
211, target]); | 66 checkLastEntry(entries, 1, [11, 111, 161, 261, 11, 111, 161, 211, 11, 111, 11,
211, target]); |
67 } | 67 } |
68 | 68 |
69 function step2() { | 69 function step2() { |
70 root.scrollTop = 0; | 70 root.scrollTop = 0; |
71 root.insertBefore(target, trailingSpace); | 71 root.insertBefore(target, trailingSpace); |
72 runTestCycle(step3, "root.insertBefore(target, trailingSpace)."); | 72 runTestCycle(step3, "root.insertBefore(target, trailingSpace)."); |
73 checkLastEntry(entries, 1, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, target]); | 73 checkLastEntry(entries, 2, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, target]); |
74 } | 74 } |
75 | 75 |
76 function step3() { | 76 function step3() { |
77 root.scrollTop = 150; | 77 root.scrollTop = 150; |
78 runTestCycle(step4, "root.scrollTop = 150 after reinserting target."); | 78 runTestCycle(step4, "root.scrollTop = 150 after reinserting target."); |
79 checkLastEntry(entries, 1); | 79 checkLastEntry(entries, 2); |
80 } | 80 } |
81 | 81 |
82 function step4() { | 82 function step4() { |
83 checkLastEntry(entries, 2, [11, 111, 161, 261, 11, 111, 161, 211, 11, 111, 11,
211, target]); | 83 checkLastEntry(entries, 3, [11, 111, 161, 261, 11, 111, 161, 211, 11, 111, 11,
211, target]); |
84 } | 84 } |
85 </script> | 85 </script> |
OLD | NEW |