diff options
Diffstat (limited to 'testing/web-platform/tests/intersection-observer/v2/scaled-target.html')
-rw-r--r-- | testing/web-platform/tests/intersection-observer/v2/scaled-target.html | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/testing/web-platform/tests/intersection-observer/v2/scaled-target.html b/testing/web-platform/tests/intersection-observer/v2/scaled-target.html new file mode 100644 index 0000000000..f48f0792d0 --- /dev/null +++ b/testing/web-platform/tests/intersection-observer/v2/scaled-target.html @@ -0,0 +1,62 @@ +<!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: 100px; + height: 100px; + border: 0; + margin-bottom: 10px; +} +#occluder { + width: 100px; + height: 100px; + background-color: blue; + position: relative; +} +</style> + +<iframe id="iframe" src="../resources/scaled-target-subframe.html"></iframe> +<div id="occluder"></div> + +<script> +async_test(function(t) { + let iframe = document.getElementById("iframe"); + + function step0(event) { + assert_equals(event.data, ""); + } + + function step1(event) { + iframe.style.transform = "scale(2)"; + assert_equals(JSON.stringify(event.data), + JSON.stringify([true])); + } + + function step2(event) { + assert_equals(JSON.stringify(event.data), + JSON.stringify([false])); + } + + let steps = [step0, step1, step2]; + + window.addEventListener("message", event => { + if (steps.length) { + t.step(steps.shift(), t, event); + waitForFrame(t, () => { + iframe.contentWindow.postMessage("", "*") + }); + } else { + t.done(); + } + }); + +}, "IntersectionObserver V2 test with scale applied to target."); +</script> |