accessible/tests/mochitest/textselection/test_userinput.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <html>
     3 <head>
     4   <title>Text selection by user input</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="../role.js"></script>
    18   <script type="application/javascript"
    19           src="../states.js"></script>
    20   <script type="application/javascript"
    21           src="../events.js"></script>
    23   <script type="application/javascript">
    24     /**
    25      * Invokers
    26      */
    27     function synthTabAndCheckPrevTabbed(aID, aPrevID)
    28     {
    29       this.__proto__ = new synthTab(aID, new focusChecker(aID));
    31       this.finalCheck = function changeSelection_finalCheck()
    32       {
    33         var prevTabbed = getAccessible(aPrevID, [ nsIAccessibleText ]);
    34         is(prevTabbed.selectionCount, 0,
    35            "Wrong selection count for " + aPrevID);
    37         var exceptionCaught = false;
    38         try {
    39           var startOffsetObj = {}, endOffsetObj = {};
    40           prevTabbed.getSelectionBounds(0, startOffsetObj, endOffsetObj);
    41         } catch (e) {
    42           exceptionCaught = true;
    43         }
    45         ok(exceptionCaught, "No selection was expected for " + aPrevID);
    46       }
    48       this.getID = function changeSelection_getID()
    49       {
    50         return "Hidden selection check for " + aPrevID;
    51       }
    52     }
    54     /**
    55      * Do tests
    56      */
    58     //gA11yEventDumpToConsole = true; // debug stuff
    60     var gQueue = null;
    61     function doTests()
    62     {
    63       gQueue = new eventQueue();
    65       // Tab to 't2' and then tab out it: it must has no selection.
    66       gQueue.push(new synthFocus("t1"));
    67       gQueue.push(new synthTab("t2", new focusChecker("t2")));
    68       gQueue.push(new synthTabAndCheckPrevTabbed("t3", "t2"));
    70       gQueue.invoke(); // Will call SimpleTest.finish();
    71     }
    73     SimpleTest.waitForExplicitFinish();
    74     addA11yLoadEvent(doTests);
    75   </script>
    76 </head>
    78 <body>
    80   <a target="_blank"
    81      href="https://bugzilla.mozilla.org/show_bug.cgi?id=440590"
    82      title="Text selection information is not updated when HTML and XUL entries lose focus">
    83     Bug 440590
    84   </a>
    85   <p id="display"></p>
    86   <div id="content" style="display: none"></div>
    87   <pre id="test">
    88   </pre>
    90   <input type="text" id="t1" maxlength="3" size="3" value="1">
    91   <input type="text" id="t2" maxlength="3" size="3" value="1">
    92   <input type="text" id="t3" maxlength="3" size="3" value="1">
    94 </body>
    95 </html>

mercurial