tor-browser

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

mouseClickCount.html (1371B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>TestDriver actions: test the mouse click counts at different cases</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 
     10 <style>
     11 div#test {
     12  position: fixed;
     13  touch-action: none;
     14  top: 5px;
     15  left: 5px;
     16  width: 100px;
     17  height: 100px;
     18  background-color: blue;
     19 }
     20 </style>
     21 
     22 <div id="test">
     23 </div>
     24 
     25 <script>
     26 let clickCountList = [];
     27 
     28 async_test(t => {
     29  let test = document.getElementById("test");
     30  test.addEventListener("click", e => {
     31    clickCountList.push(e.detail);
     32  });
     33 
     34  let div = document.getElementById("test");
     35  var actions = new test_driver.Actions();
     36  actions.pointerMove(0, 0, {origin: test})
     37    .pointerDown()
     38    .pointerUp()
     39    .pointerDown()
     40    .pointerUp()
     41    .pointerMove(15, 15, {origin: test})
     42    .pointerDown()
     43    .pointerUp()
     44    .pointerDown()
     45    .pointerUp()
     46    .pointerDown()
     47    .pointerUp()
     48    .send()
     49    .then(t.step_func_done(() => {
     50      let expectedClickCountList = [1, 2, 1, 2, 3];
     51      assert_array_equals(clickCountList, expectedClickCountList);
     52  })).catch(e => t.step_func(() => assert_unreached("Actions sequence failed " + e)));
     53 });
     54 </script>