tor-browser

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

test_bug1109465.html (1709B)


      1 <!DOCTYPE>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=1109465
      5 -->
      6 <head>
      7  <title>Test for Bug 1109465</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 <div id="display">
     14  <textarea></textarea>
     15 </div>
     16 <div id="content" style="display: none">
     17  
     18 </div>
     19 <pre id="test">
     20 </pre>
     21 
     22 <script class="testbody" type="application/javascript">
     23 
     24 /** Test for Bug 1109465 */
     25 SimpleTest.waitForExplicitFinish();
     26 SimpleTest.waitForFocus(function() {
     27  var t = document.querySelector("textarea");
     28  t.focus();
     29 
     30  // Type foo\nbar and place the caret at the end of the last line
     31  sendString("foo");
     32  synthesizeKey("KEY_Enter");
     33  sendString("bar");
     34  synthesizeKey("KEY_ArrowUp");
     35  is(t.selectionStart, 3, "Correct start of selection");
     36  is(t.selectionEnd, 3, "Correct end of selection");
     37 
     38  // Compose an IME string
     39  var composingString = "\u306B";
     40  // FYI: "compositionstart" will be dispatched automatically.
     41  synthesizeCompositionChange(
     42    { "composition":
     43      { "string": composingString,
     44        "clauses":
     45        [
     46          { "length": 1, "attr": COMPOSITION_ATTR_RAW_CLAUSE },
     47        ],
     48      },
     49      "caret": { "start": 1, "length": 0 },
     50    });
     51  synthesizeComposition({ type: "compositioncommitasis" });
     52  is(t.value, "foo\u306B\nbar", "Correct value after composition");
     53 
     54  // Now undo to test that the transaction merger has correctly detected the
     55  // IMETextTxn.
     56  synthesizeKey("Z", {accelKey: true});
     57  is(t.value, "foo\nbar", "Correct value after undo");
     58 
     59  SimpleTest.finish();
     60 });
     61 
     62 </script>
     63 </body>
     64 
     65 </html>