accessible/tests/mochitest/events/test_textselchange.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial