tor-browser

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

test_bug966155.html (1579B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=966155
      5 -->
      6 <head>
      7  <title>Test for Bug 966155</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <script src="/tests/SimpleTest/EventUtils.js"></script>
     10  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     11 </head>
     12 <body>
     13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=966155">Mozilla Bug 966155</a>
     14 <p id="display"></p>
     15 <div id="content" style="display: none">
     16 </div>
     17 <pre id="test">
     18 <script class="testbody" type="text/javascript">
     19 SimpleTest.waitForExplicitFinish();
     20 
     21 var testWindow = window.open("file_bug966155.html", "", "test-966155");
     22 testWindow.addEventListener("load", function() {
     23  runTest(testWindow);
     24 }, {once: true});
     25 
     26 function runTest(win) {
     27  SimpleTest.waitForFocus(function() {
     28    var doc = win.document;
     29    var iframe = doc.querySelector("iframe");
     30    var iframeDoc = iframe.contentDocument;
     31    var input = doc.querySelector("input");
     32    iframe.focus();
     33    iframeDoc.body.focus();
     34    // Type some text
     35    "test".split("").forEach(function(letter) {
     36      synthesizeKey(letter, {}, win);
     37    });
     38    is(iframeDoc.body.textContent.trim(), "test", "entered the text");
     39    // focus the input box
     40    input.focus();
     41    // press tab
     42    synthesizeKey("VK_TAB", {}, win);
     43    // Now press Ctrl+Backspace
     44    synthesizeKey("VK_BACK_SPACE", {ctrlKey: true}, win);
     45    is(iframeDoc.body.textContent.trim(), "", "deleted the text");
     46    win.close();
     47    SimpleTest.finish();
     48  }, win);
     49 }
     50 
     51 </script>
     52 </pre>
     53 </body>
     54 </html>