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.

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

mercurial