Files
firefox/testing/web-platform/tests/intersection-observer/client-rect.html
T
Ali Juma 43f76aff22 Bug 1475789 [wpt PR 11984] - Upstream more IntersectionObserver tests to Web Platform Tests, a=testonly
Automatic update from web-platform-testsUpstream more IntersectionObserver tests to Web Platform Tests

This upstreams text-target.html, as well as a change to
client-rect.html. This also deletes the non-WPT copy of these
tests to avoid unnecessary test duplication.

Cq-Include-Trybots: luci.chromium.try​:linux_layout_tests_layout_ng
Change-Id: Ic53b3be66ffa2b2dd5b77105eb2c8e02181bac81
Reviewed-on: https://chromium-review.googlesource.com/1136939
Reviewed-by: Stefan Zager <[email protected]>
Commit-Queue: Ali Juma <[email protected]>
Cr-Commit-Position: refs/heads/master@{#575775}

--

wpt-commits: 69f77c2fe1ce1d8d6ac4ccd3f3261b56a573a73a
wpt-pr: 11984
2018-07-29 18:50:06 +01:00

46 lines
1.3 KiB
HTML

<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./resources/intersection-observer-test-utils.js"></script>
<style>
pre, #log {
position: absolute;
top: 0;
left: 200px;
}
iframe {
width: 180px;
height: 100px;
}
</style>
<iframe id="iframe" srcdoc="<div id='target' style='margin:0.5px;width:1000px;height:1000px;'></div>"></iframe>
<script>
var target;
var entries = [];
var observer;
var iframe = document.getElementById("iframe");
iframe.onload = function() {
runTestCycle(function() {
target = iframe.contentDocument.getElementById("target");
assert_true(!!target, "Target element exists.");
observer = new IntersectionObserver(function(changes) {
entries = entries.concat(changes);
});
observer.observe(target);
entries = entries.concat(observer.takeRecords());
assert_equals(entries.length, 0, "No initial notifications.");
runTestCycle(test0, "First rAF should generate notification.");
}, "IntersectionObserverEntry.boundingClientRect should match target.boundingClientRect()");
};
function test0() {
assert_equals(entries.length, 1, "One notification.");
var bcr = target.getBoundingClientRect();
checkLastEntry(entries, 0, [bcr.left, bcr.right, bcr.top, bcr.bottom]);
}
</script>