mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Update web-platform-tests to revision 81962ac8802223d038b188b6f9cb88a0a9c5beee
This commit is contained in:
parent
fe1a057bd1
commit
24183668c4
1960 changed files with 29853 additions and 10555 deletions
|
@ -0,0 +1,58 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>User activation with 'contextmenu' event</title>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
|
||||
<link rel="author" title="Google" href="http://www.google.com "/>
|
||||
<link rel="help" href="https://html.spec.whatwg.org/#triggered-by-user-activation">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<style>
|
||||
#target {
|
||||
width: 250px;
|
||||
height: 150px;
|
||||
float: left;
|
||||
background-color: green;
|
||||
}
|
||||
|
||||
#done {
|
||||
float: left;
|
||||
padding: 20px;
|
||||
margin: 10px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
let activation_event_fired = false;
|
||||
|
||||
function run() {
|
||||
let success = false;
|
||||
let test_contextmenu = async_test("'contextmenu' can call vibrate.");
|
||||
|
||||
on_event(document.getElementById("done"), "click", () => {
|
||||
test_contextmenu.step(() => {
|
||||
assert_true(activation_event_fired, "activation event has fired");
|
||||
});
|
||||
test_contextmenu.done();
|
||||
});
|
||||
|
||||
on_event(document.getElementById("target"), "contextmenu", (e) => {
|
||||
test_contextmenu.step(() => {
|
||||
e.preventDefault();
|
||||
assert_true(navigator.vibrate(200), "navigator.vibrate is successful");
|
||||
activation_event_fired = true;
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="run()">
|
||||
<h1>User activation with 'contextmenu' event</h1>
|
||||
<h4>Tests that a 'contextmenu' event is treated like a user activation.</h4>
|
||||
<ol>
|
||||
<li>Right-click or long-press on green.</li>
|
||||
<li>Click or tap on Done.</li>
|
||||
</ol>
|
||||
<div id="target"></div>
|
||||
<input type="button" id="done" value="Done" />
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue