mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-28 04:39:07 -10:00
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
46 lines
1.3 KiB
HTML
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>
|