Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(69)

Delta Between Two Patch Sets: LayoutTests/imported/w3c/web-platform-tests/intersection-observer/text-target.html

Issue 359780043: WIP for IO
Left Patch Set: Created 5 years, 8 months ago
Right Patch Set: 22 tests pass Created 5 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
LEFTRIGHT
(no file at all)
1 <!DOCTYPE html>
2 <script src="/resources/testharness.js"></script>
3 <script src="/resources/testharnessreport.js"></script>
4 <script src="./resources/intersection-observer-test-utils.js"></script>
5
6 <style>
7 pre, #log {
8 position: absolute;
9 top: 0;
10 left: 200px;
11 }
12 .spacer {
13 height: calc(100vh + 100px);
14 }
15 </style>
16
17 <div class="spacer"></div>
18 <br id="target">
19 <div class="spacer"></div>
20
21 <script>
22 var vw = document.documentElement.clientWidth;
23 var vh = document.documentElement.clientHeight;
24
25 var entries = [];
26 var target;
27 var tw, th;
28
29 runTestCycle(function() {
30 target = document.getElementById("target");
31 let target_rect = target.getBoundingClientRect();
32 tw = target_rect.width;
33 th = target_rect.height;
34 assert_true(!!target, "target exists");
35 var observer = new IntersectionObserver(function(changes) {
36 entries = entries.concat(changes)
37 });
38 observer.observe(target);
39 entries = entries.concat(observer.takeRecords());
40 assert_equals(entries.length, 0, "No initial notifications.");
41 runTestCycle(step0, "First rAF.");
42 }, "IntersectionObserver observing a br element.");
43
44 function step0() {
45 document.scrollingElement.scrollTop = 300;
46 runTestCycle(step1, "document.scrollingElement.scrollTop = 300");
47 // The numbers in brackets are target client rect; intersection rect;
48 // and root bounds.
49 checkLastEntry(entries, 0, [8, 8 + tw, vh + 108, vh + 108 + th, 0, 0, 0, 0, 0, vw, 0, vh, false]);
50 }
51
52 function step1() {
53 document.scrollingElement.scrollTop = 100;
54 runTestCycle(step2, "document.scrollingElement.scrollTop = 100");
55 checkLastEntry(entries, 1, [8, 8 + tw, vh - 192, vh - 192 + th, 8, 8 + tw, vh - 192, vh - 192 + th, 0, vw, 0, vh, true]);
56 }
57
58 function step2() {
59 document.scrollingElement.scrollTop = 0;
60 checkLastEntry(entries, 2, [8, 8 + tw, vh + 8, vh + 8 + th, 0, 0, 0, 0, 0, vw, 0, vh, false]);
61 }
62 </script>
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b