https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 6e5bb4a67960776ca6514452283eed77e09edc62 authored by Makoto Shimazu on 10 April 2018, 01:23:59 UTC
Revert "Enable ConsumeGestureOnNavigation by default"
Tip revision: 6e5bb4a
events-manual.html
<!doctype html>
<html>
<head>
<title>Manual Gamepad events tests</title>
<link rel="help" href="https://w3c.github.io/gamepad/#the-gamepadconnected-event">
<link rel="help" href="https://w3c.github.io/gamepad/#the-gamepaddisconnected-event">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
setup({explicit_timeout: true});

function set_instructions(text) {
  document.getElementById("instructions").textContent = text;
}

var index = -1;
addEventListener("gamepadconnected", function (e) {
  assert_equals(index, -1, "Too many connected events?");
  assert_class_string(e, "GamepadEvent");
  assert_class_string(e.gamepad, "Gamepad");
  index = e.gamepad.index;
  set_instructions("Found a gamepad. Now disconnect the gamepad.");
});
addEventListener("gamepaddisconnected", function (e) {
  assert_class_string(e, "GamepadEvent");
  assert_equals(e.gamepad.index, index);
  done();
});
</script>
</head>
<body>
<p id="instructions">This test requires a gamepad. Connect one and press any button to start the test.</p>
</body>
</html>
back to top