tor-browser

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

keyboardevent-legacy.html (1242B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>KeyboardEvent legacy fields initialization Test: KeyCode and charCode</title>
      4 <link rel="author" title="Rakhi Sharma" href="mailto:atbrakhi@igalia.com">
      5 <link rel="help" href="https://w3c.github.io/uievents/#legacy-dictionary-KeyboardEventInit">
      6 <link rel="help" href="https://w3c.github.io/uievents/#idl-keyboardeventinit">
      7 <meta name="assert" content="KeyboardEvent constructor should initialize legacy keyCode and charCode attributes.">
      8 <script src="/resources/testharness.js"></script>
      9 <script src="/resources/testharnessreport.js"></script>
     10 
     11 <div id="log"></div>
     12 
     13 <script>
     14 var t = async_test("KeyboardEvent constructor should initialize legacy keyCode and charCode");
     15 
     16 t.step(function() {
     17  const evPress = new KeyboardEvent("keypress", { keyCode: 65, charCode: 65 });
     18  assert_equals(evPress.keyCode, 65, "keypress: initialized keyCode");
     19  assert_equals(evPress.charCode, 65, "keypress: initialized charCode");
     20 });
     21 
     22 t.step(function() {
     23  const evDown = new KeyboardEvent("keydown", { keyCode: 13, charCode: 0 });
     24  assert_equals(evDown.keyCode, 13, "keydown: initialized keyCode");
     25  assert_equals(evDown.charCode, 0, "keydown: initialized charCode should be 0");
     26 });
     27 
     28 t.done();
     29 </script>