tor-browser

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

test_textselchange.html (2721B)


      1 <html>
      2 
      3 <head>
      4  <title>Accessible text selection change events testing</title>
      5 
      6  <link rel="stylesheet" type="text/css"
      7        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
      8 
      9  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
     10  <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
     11 
     12  <script type="application/javascript"
     13          src="../common.js"></script>
     14  <script type="application/javascript"
     15          src="../text.js"></script>
     16  <script type="application/javascript"
     17          src="../events.js"></script>
     18 
     19  <script type="application/javascript">
     20    var gQueue = null;
     21 
     22    // gA11yEventDumpID = "eventdump"; // debug stuff
     23    // gA11yEventDumpToConsole = true;
     24 
     25    function getOnclickSeq(aID) {
     26      return [
     27        new caretMoveChecker(0, true, aID),
     28        new unexpectedInvokerChecker(EVENT_TEXT_SELECTION_CHANGED, aID),
     29      ];
     30    }
     31 
     32    function doTests() {
     33      // test caret move events and caret offsets
     34      gQueue = new eventQueue();
     35 
     36      gQueue.push(new synthClick("c1_p1", getOnclickSeq("c1_p1")));
     37      gQueue.push(new synthDownKey("c1", new textSelectionChecker("c1", 0, 1, "c1_p1", 0, "c1_p2", 0), { shiftKey: true }));
     38      gQueue.push(new synthDownKey("c1", new textSelectionChecker("c1", 0, 2, "c1_p1", 0, "c1_p2", 9), { shiftKey: true }));
     39 
     40      gQueue.push(new synthClick("ta1", getOnclickSeq("ta1")));
     41      gQueue.push(new synthRightKey("ta1",
     42                                    new textSelectionChecker("ta1", 0, 1, "ta1", 0, "ta1", 1),
     43                                    { shiftKey: true }));
     44      gQueue.push(new synthLeftKey("ta1",
     45                                    [new textSelectionChecker("ta1", 0, 0, "ta1", 0, "ta1", 0),
     46                                     new caretMoveChecker(0, true, "ta1")]));
     47 
     48      gQueue.invoke(); // Will call SimpleTest.finish();
     49    }
     50 
     51    SimpleTest.waitForExplicitFinish();
     52    addA11yLoadEvent(doTests);
     53  </script>
     54 </head>
     55 
     56 <body>
     57 
     58  <a target="_blank"
     59     href="https://bugzilla.mozilla.org/show_bug.cgi?id=762934"
     60     title="Text selection change event has a wrong target when selection is spanned through several objects">
     61    Bug 762934
     62  </a>
     63  <a target="_blank"
     64     href="https://bugzilla.mozilla.org/show_bug.cgi?id=956032"
     65     title="Text selection change event missed when selected text becomes unselected">
     66    Bug 956032
     67  </a>
     68  <p id="display"></p>
     69  <div id="content" style="display: none"></div>
     70  <pre id="test">
     71  </pre>
     72 
     73  <div id="c1" contentEditable="true">
     74    <p id="c1_p1">paragraph</p>
     75    <p id="c1_p2">paragraph</p>
     76  </div>
     77 
     78  <textarea id="ta1">Hello world</textarea>
     79 
     80  <div id="eventdump"></div>
     81 </body>
     82 </html>