blob: e5256c7d7ba47e4c95735cee262bc6f26482e7c9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
<!DOCTYPE html>
<meta charset="utf-8">
<title>Remove PointerLock target on mouseup</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<p>Click anywhere to run the test. If a "PASS" result appears the test passes, otherwise it fails</p>
<div id="target"></div>
<script>
async_test(t => {
const target = document.getElementById('target');
document.addEventListener('mousedown', t.step_func(() => {
target.requestPointerLock();
document.addEventListener('mouseup', t.step_func(() => {
target.remove();
assert_equals(document.pointerLockElement, null, 'Pointer lock exited!');
t.done();
}));
}));
})
// Inject mouse input.
new test_driver.Actions()
.pointerMove(50, 50)
.pointerDown()
.pointerUp()
.send();
</script>
|