mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-11 13:48:23 +02:00
Automatic update from web-platform-testsFix #10875: run parsed lints for visual tests CSS tests, due to their metadata requirement, default to visual tests, hence it's important we run all of these lints (to in this case catch ../testharness.js) -- Extend the previous commit to also check manual tests Plenty of manual tests use testharness.js so we should check them too, and indeed there's plenty of broken tests so fix them too -- wpt-commits: b54c11b055959abeefafcde601853ea4cb247e0b, c327c2747db6b71c8c45f61e0a97785a9be622c2 wpt-pr: 10876
85 lines
2.1 KiB
HTML
85 lines
2.1 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<body>
|
|
<meta name="timeout" content="long">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<meta name='flags' content='interact'>
|
|
<style type="text/css">
|
|
button {
|
|
color: blue;
|
|
}
|
|
|
|
#target-wrap {
|
|
position: relative;
|
|
background-color: lightgrey;
|
|
width: 200px;
|
|
height: 100px;
|
|
border: grey 1px solid;
|
|
}
|
|
|
|
#target {
|
|
position: relative;
|
|
background-color: lightyellow;
|
|
width: 100px;
|
|
height: 30px;
|
|
border: yellow 1px solid;
|
|
}
|
|
|
|
#status-log {
|
|
margin: 10px 0;
|
|
color: green;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h2>Description</h2>
|
|
<p>This test validates that pointer lock will be lost the user agent / window loses focus.</p>
|
|
<hr/>
|
|
|
|
<h2>Manual Test Steps:</h2>
|
|
<p>
|
|
<ol>
|
|
<li>Click the "lockTarget" button to request a pointer lock.</li>
|
|
<li>Focus to another tab with keyboard (Ctrl-TAB).</li>
|
|
<li>Test is done.</li>
|
|
</ol>
|
|
</p>
|
|
<hr/>
|
|
|
|
<button onclick="lockTarget();">lockTarget</button>
|
|
|
|
<div id="target-wrap">
|
|
<div id="status-log">Click the "lockTarget" button.</div>
|
|
<div id="target">Target</div>
|
|
</div>
|
|
<hr/>
|
|
|
|
<div id="log"></div>
|
|
|
|
<script type="text/javascript" >
|
|
var target = document.querySelector('#target'),
|
|
status_log = document.querySelector('#status-log');
|
|
|
|
var leaveTabTest = async_test("Test that pointer lock will be lost when the current Tab loses focus.");
|
|
|
|
document.addEventListener("pointerlockchange", function() {
|
|
if(document.pointerLockElement) {
|
|
status_log.innerHTML = "Please leave the current tab.";
|
|
} else {
|
|
status_log.innerHTML = "Pointer lock exited!";
|
|
|
|
leaveTabTest.step(function() {
|
|
assert_true(document.pointerLockElement === null, "Pointer lock exited!");
|
|
});
|
|
|
|
leaveTabTest.done();
|
|
}
|
|
});
|
|
|
|
function lockTarget() {
|
|
target.requestPointerLock();
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|