tor-browser

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

test_bug1409520.html (1343B)


      1 <!DOCTYPE html>
      2 <!--
      3 https://bugzilla.mozilla.org/show_bug.cgi?id=1409520
      4 -->
      5 <html>
      6 <head>
      7  <title>Test for Bug 1409520</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     10 </head>
     11 <body>
     12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1409520">Mozilla Bug 1409520</a>
     13 <p id="display"></p>
     14 <div id="content" style="display: none;">
     15 
     16 </div>
     17 
     18 <li contenteditable id="editor">
     19  <select><option>option1</option></select>
     20 </li>
     21 
     22 <pre id="test">
     23 
     24 <script class="testbody" type="application/javascript">
     25 SimpleTest.waitForExplicitFinish();
     26 SimpleTest.waitForFocus(function() {
     27  var selection = window.getSelection();
     28  var editor = document.getElementById("editor");
     29  editor.focus();
     30  selection.collapse(editor, 0);
     31  document.execCommand("insertText", false, "A");
     32  is(editor.firstChild.textContent, "A",
     33     "'A' should be inserted at start of the editor");
     34  is(editor.firstChild.nextSibling.tagName, "SELECT",
     35     "<select> element shouldn't be removed by inserting 'A'");
     36  is(selection.getRangeAt(0).startContainer, editor.firstChild,
     37     "Caret should be moved after 'A'");
     38  is(selection.getRangeAt(0).startOffset, 1,
     39     "Caret should be moved after 'A'");
     40  SimpleTest.finish();
     41 });
     42 </script>
     43 </pre>
     44 </body>
     45 </html>