tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

pointerlock_remove_target_on_mouseup.html (1071B)


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