1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/tests/mochitest/textselection/test_userinput.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,95 @@ 1.4 +<html> 1.5 + 1.6 +<head> 1.7 + <title>Text selection by user input</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="../role.js"></script> 1.21 + <script type="application/javascript" 1.22 + src="../states.js"></script> 1.23 + <script type="application/javascript" 1.24 + src="../events.js"></script> 1.25 + 1.26 + <script type="application/javascript"> 1.27 + /** 1.28 + * Invokers 1.29 + */ 1.30 + function synthTabAndCheckPrevTabbed(aID, aPrevID) 1.31 + { 1.32 + this.__proto__ = new synthTab(aID, new focusChecker(aID)); 1.33 + 1.34 + this.finalCheck = function changeSelection_finalCheck() 1.35 + { 1.36 + var prevTabbed = getAccessible(aPrevID, [ nsIAccessibleText ]); 1.37 + is(prevTabbed.selectionCount, 0, 1.38 + "Wrong selection count for " + aPrevID); 1.39 + 1.40 + var exceptionCaught = false; 1.41 + try { 1.42 + var startOffsetObj = {}, endOffsetObj = {}; 1.43 + prevTabbed.getSelectionBounds(0, startOffsetObj, endOffsetObj); 1.44 + } catch (e) { 1.45 + exceptionCaught = true; 1.46 + } 1.47 + 1.48 + ok(exceptionCaught, "No selection was expected for " + aPrevID); 1.49 + } 1.50 + 1.51 + this.getID = function changeSelection_getID() 1.52 + { 1.53 + return "Hidden selection check for " + aPrevID; 1.54 + } 1.55 + } 1.56 + 1.57 + /** 1.58 + * Do tests 1.59 + */ 1.60 + 1.61 + //gA11yEventDumpToConsole = true; // debug stuff 1.62 + 1.63 + var gQueue = null; 1.64 + function doTests() 1.65 + { 1.66 + gQueue = new eventQueue(); 1.67 + 1.68 + // Tab to 't2' and then tab out it: it must has no selection. 1.69 + gQueue.push(new synthFocus("t1")); 1.70 + gQueue.push(new synthTab("t2", new focusChecker("t2"))); 1.71 + gQueue.push(new synthTabAndCheckPrevTabbed("t3", "t2")); 1.72 + 1.73 + gQueue.invoke(); // Will call SimpleTest.finish(); 1.74 + } 1.75 + 1.76 + SimpleTest.waitForExplicitFinish(); 1.77 + addA11yLoadEvent(doTests); 1.78 + </script> 1.79 +</head> 1.80 + 1.81 +<body> 1.82 + 1.83 + <a target="_blank" 1.84 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=440590" 1.85 + title="Text selection information is not updated when HTML and XUL entries lose focus"> 1.86 + Bug 440590 1.87 + </a> 1.88 + <p id="display"></p> 1.89 + <div id="content" style="display: none"></div> 1.90 + <pre id="test"> 1.91 + </pre> 1.92 + 1.93 + <input type="text" id="t1" maxlength="3" size="3" value="1"> 1.94 + <input type="text" id="t2" maxlength="3" size="3" value="1"> 1.95 + <input type="text" id="t3" maxlength="3" size="3" value="1"> 1.96 + 1.97 +</body> 1.98 +</html>