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

Side by Side Diff: third_party/WebKit/LayoutTests/intersection-observer/disconnect.html

Issue 2684733002: IntersectionObserver: discard notifications upon disconnect(). (Closed)
Patch Set: Add layout 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/IntersectionObserver.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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: 700px;
14 }
15 #target {
16 width: 100px;
17 height: 100px;
18 background-color: green;
19 }
20 </style>
21
22 <div class="spacer"></div>
23 <div id="target"></div>
24 <div class="spacer"></div>
25
26 <script>
27 var entries = [];
28 var observer;
29 var target;
30
31 runTestCycle(function() {
32 assert_equals(window.innerWidth, 800, "Window must be 800 pixels wide.");
33 assert_equals(window.innerHeight, 600, "Window must be 600 pixels high.");
34
35 target = document.getElementById("target");
36 assert_true(!!target, "target exists");
37 observer = new IntersectionObserver(function(changes) {
38 entries = entries.concat(changes)
39 });
40 observer.observe(target);
41 entries = entries.concat(observer.takeRecords());
42 assert_equals(entries.length, 0, "No initial notifications.");
43 runTestCycle(step0, "First rAF.");
44 }, "IntersectionObserver should not deliver pending notifications after disconne ct().");
45
46 function step0() {
47 runTestCycle(step1, "observer.disconnect()");
48 document.scrollingElement.scrollTop = 300;
49 observer.disconnect();
50 assert_equals(entries.length, 1, "Initial notification.");
51 }
52
53 function step1() {
54 assert_equals(entries.length, 1, "No new notifications.");
55 }
56 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/IntersectionObserver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698