Bug 1539614 [wpt PR 16077] - HTML: move textarea tests together, a=testonly
[gecko.git] / testing / web-platform / tests / pointerlock / pointerlock_leave_Tab-manual.html
blobf32c71abe5bb742960be9364817b374536c418c1
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <meta name="timeout" content="long">
5 <script src="/resources/testharness.js"></script>
6 <script src="/resources/testharnessreport.js"></script>
7 <meta name='flags' content='interact'>
8 <style type="text/css">
9 button {
10 color: blue;
13 #target-wrap {
14 position: relative;
15 background-color: lightgrey;
16 width: 200px;
17 height: 100px;
18 border: grey 1px solid;
21 #target {
22 position: relative;
23 background-color: lightyellow;
24 width: 100px;
25 height: 30px;
26 border: yellow 1px solid;
29 #status-log {
30 margin: 10px 0;
31 color: green;
33 </style>
34 </head>
35 <body>
36 <h2>Description</h2>
37 <p>This test validates that pointer lock will be lost the user agent / window loses focus.</p>
38 <hr/>
40 <h2>Manual Test Steps:</h2>
41 <p>
42 <ol>
43 <li>Click the "lockTarget" button to request a pointer lock.</li>
44 <li>Focus to another tab with keyboard (Ctrl-TAB).</li>
45 <li>Test is done.</li>
46 </ol>
47 </p>
48 <hr/>
50 <button onclick="lockTarget();">lockTarget</button>
52 <div id="target-wrap">
53 <div id="status-log">Click the "lockTarget" button.</div>
54 <div id="target">Target</div>
55 </div>
56 <hr/>
58 <div id="log"></div>
60 <script type="text/javascript" >
61 var target = document.querySelector('#target'),
62 status_log = document.querySelector('#status-log');
64 var leaveTabTest = async_test("Test that pointer lock will be lost when the current Tab loses focus.");
66 document.addEventListener("pointerlockchange", function() {
67 if(document.pointerLockElement) {
68 status_log.innerHTML = "Please leave the current tab.";
69 } else {
70 status_log.innerHTML = "Pointer lock exited!";
72 leaveTabTest.step(function() {
73 assert_true(document.pointerLockElement === null, "Pointer lock exited!");
74 });
76 leaveTabTest.done();
78 });
80 function lockTarget() {
81 target.requestPointerLock();
83 </script>
84 </body>
85 </html>