accessible/tests/mochitest/events/test_textselchange.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/tests/mochitest/events/test_textselchange.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,85 @@
     1.4 +<html>
     1.5 +
     1.6 +<head>
     1.7 +  <title>Accessible text selection change events testing</title>
     1.8 +
     1.9 +  <link rel="stylesheet" type="text/css"
    1.10 +        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
    1.11 +
    1.12 +  <script type="application/javascript"
    1.13 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    1.14 +  <script type="application/javascript"
    1.15 +          src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
    1.16 +
    1.17 +  <script type="application/javascript"
    1.18 +          src="../common.js"></script>
    1.19 +  <script type="application/javascript"
    1.20 +          src="../text.js"></script>
    1.21 +  <script type="application/javascript"
    1.22 +          src="../events.js"></script>
    1.23 +
    1.24 +  <script type="application/javascript">
    1.25 +    var gQueue = null;
    1.26 +
    1.27 +    // gA11yEventDumpID = "eventdump"; // debug stuff
    1.28 +    //gA11yEventDumpToConsole = true;
    1.29 +
    1.30 +    function getOnclickSeq(aID)
    1.31 +    {
    1.32 +      return [
    1.33 +        new caretMoveChecker(0, aID), 
    1.34 +        new unexpectedInvokerChecker(EVENT_TEXT_SELECTION_CHANGED, aID)
    1.35 +      ];
    1.36 +    }
    1.37 +
    1.38 +    function doTests()
    1.39 +    {
    1.40 +      // test caret move events and caret offsets
    1.41 +      gQueue = new eventQueue();
    1.42 +
    1.43 +      gQueue.push(new synthClick("c1_p1", getOnclickSeq("c1_p1")));
    1.44 +      gQueue.push(new synthDownKey("c1", new textSelectionChecker("c1", 0, 1), { shiftKey: true }));
    1.45 +      gQueue.push(new synthDownKey("c1", new textSelectionChecker("c1", 0, 2), { shiftKey: true }));
    1.46 +
    1.47 +      gQueue.push(new synthClick("ta1", getOnclickSeq("ta1")));
    1.48 +      gQueue.push(new synthRightKey("ta1",
    1.49 +                                    new textSelectionChecker("ta1", 0, 1),
    1.50 +                                    { shiftKey: true }));
    1.51 +      gQueue.push(new synthLeftKey("ta1",
    1.52 +                                    new textSelectionChecker("ta1", 0, 0)));
    1.53 +
    1.54 +      gQueue.invoke(); // Will call SimpleTest.finish();
    1.55 +    }
    1.56 +
    1.57 +    SimpleTest.waitForExplicitFinish();
    1.58 +    addA11yLoadEvent(doTests);
    1.59 +  </script>
    1.60 +</head>
    1.61 +
    1.62 +<body>
    1.63 +
    1.64 +  <a target="_blank"
    1.65 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=762934"
    1.66 +     title="Text selection change event has a wrong target when selection is spanned through several objects">
    1.67 +    Bug 762934
    1.68 +  </a>
    1.69 +  <a target="_blank"
    1.70 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=956032"
    1.71 +     title="Text selection change event missed when selected text becomes unselected">
    1.72 +    Bug 956032
    1.73 +  </a>
    1.74 +  <p id="display"></p>
    1.75 +  <div id="content" style="display: none"></div>
    1.76 +  <pre id="test">
    1.77 +  </pre>
    1.78 +
    1.79 +  <div id="c1" contentEditable="true">
    1.80 +    <p id="c1_p1">paragraph</p>
    1.81 +    <p id="c1_p2">paragraph</p>
    1.82 +  </div>
    1.83 +
    1.84 +  <textarea id="ta1">Hello world</textarea>
    1.85 +
    1.86 +  <div id="eventdump"></div>
    1.87 +</body>
    1.88 +</html>

mercurial