blob: 5f17252dfb5ea360fc5b6619ba48f02f3ba17a0e [file] [log] [blame]
<!doctype HTML>
<html>
<meta charset="utf8">
<title>Display Locking: commit in beforeactivate</title>
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
<link rel="help" href="https://github.com/WICG/display-locking">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/utils.js"></script>
<style>
div {
contain: style layout;
}
</style>
<div id="target"></div>
<script>
'use strict';
async_test((t) => {
async function commit(target) {
setVisible(target);
t.done();
}
async function runTest() {
const target = document.getElementById("target");
await setInvisibleActivatable(target);
t.step(() => assert_true(target.displayLock.locked));
target.addEventListener("beforeactivate", () => commit(target));
target.scrollIntoView();
}
window.onload = () => requestAnimationFrame(() => requestAnimationFrame(runTest));
}, "Commit in beforeactivate");
</script>