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

Unified Diff: third_party/WebKit/LayoutTests/intersection-observer/zero-area-element-hidden.html

Issue 2556243003: IntersectionObserver: compute correct intersection ratio for 0x0 elements (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/intersection-observer/zero-area-element-hidden.html
diff --git a/third_party/WebKit/LayoutTests/intersection-observer/zero-area-element-hidden.html b/third_party/WebKit/LayoutTests/intersection-observer/zero-area-element-hidden.html
new file mode 100644
index 0000000000000000000000000000000000000000..26c8ccd3398cac7be21c4c8fef76cc3ad6ce0f54
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/intersection-observer/zero-area-element-hidden.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<script src="../resources/js-test.js"></script>
foolip 2016/12/08 16:28:59 It looks like this test doesn't depend on any inte
Sami 2016/12/09 17:24:36 I'll give it a shot. This was just a carbon copy o
+<script src="../resources/intersection-observer-helper-functions.js"></script>
+<div id='target' style='width:0px; height:0px; position: fixed; top: -1000px'</div>"
+<script>
+description("Ensure that a hidden zero-area element is treated correctly.");
foolip 2016/12/08 16:28:59 With testharness.js this can go in <title>, if the
+
+var entries = [];
+var target;
+
+onload = function() {
foolip 2016/12/08 16:28:59 Does the test need to wait for the window load eve
Sami 2016/12/09 17:24:36 You're right -- there's no need to wait for anythi
+ target = document.getElementById("target");
+ new IntersectionObserver((changes) => {
+ entries.push(...changes);
+ }).observe(target);
+ waitForNotification(step0);
foolip 2016/12/08 16:28:59 With testharness.js, this would be: waitForNotific
Sami 2016/12/09 17:24:36 Done.
+};
+
+function step0() {
+ // Since the element is initially assumed to be hidden, there are no entries.
+ shouldBeEqualToNumber("entries.length", 0);
+ finishJSTest();
+}
+</script>

Powered by Google App Engine
This is Rietveld 408576698