tor-browser

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

focus-01.html (1629B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>HTML Test: focus - key events</title>
      4 <meta name="timeout" content="long">
      5 <link rel="author" title="Intel" href="http://www.intel.com/">
      6 <link rel="help" href="https://html.spec.whatwg.org/multipage/#focus">
      7 <meta assert="flag" content="interact">
      8 <meta assert="assert" content="Check if the key events received by document are targeted at the element when it is focused">
      9 <script src="/resources/testharness.js"></script>
     10 <script src="/resources/testharnessreport.js"></script>
     11 <script src="/resources/testdriver.js"></script>
     12 <script src="/resources/testdriver-vendor.js"></script>
     13 <div id="log"></div>
     14 <input id="test">
     15 <script>
     16 
     17 var t1 = async_test("The keydown event must be targeted at the input element"),
     18    t2 = async_test("The keypress event must be targeted at the input element"),
     19    t3 = async_test("The keyup event must be targeted at the input element"),
     20    testEle;
     21 
     22 setup(function () {
     23  testEle = document.getElementById("test");
     24  testEle.focus();
     25 });
     26 
     27 document.onkeydown = t1.step_func_done(function(evt){
     28  assert_equals(evt.target, testEle, "The keydown events must be targeted at the input element.");
     29 });
     30 
     31 document.onkeypress = t2.step_func_done(function(evt){
     32  assert_equals(evt.target, testEle, "The keypress events must be targeted at the input element.");
     33 });
     34 
     35 document.onkeyup = t3.step_func_done(function(evt){
     36  assert_equals(evt.target, testEle, "The keyup events must be targeted at the input element.");
     37 });
     38 
     39 var input_element = document.getElementById("test");
     40 
     41 t1.step(function() {
     42  test_driver.send_keys(input_element, "a");
     43 });
     44 
     45 </script>