|
1 <html> |
|
2 |
|
3 <head> |
|
4 <title>Text selection by user input</title> |
|
5 |
|
6 <link rel="stylesheet" type="text/css" |
|
7 href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
|
8 |
|
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> |
|
13 |
|
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> |
|
22 |
|
23 <script type="application/javascript"> |
|
24 /** |
|
25 * Invokers |
|
26 */ |
|
27 function synthTabAndCheckPrevTabbed(aID, aPrevID) |
|
28 { |
|
29 this.__proto__ = new synthTab(aID, new focusChecker(aID)); |
|
30 |
|
31 this.finalCheck = function changeSelection_finalCheck() |
|
32 { |
|
33 var prevTabbed = getAccessible(aPrevID, [ nsIAccessibleText ]); |
|
34 is(prevTabbed.selectionCount, 0, |
|
35 "Wrong selection count for " + aPrevID); |
|
36 |
|
37 var exceptionCaught = false; |
|
38 try { |
|
39 var startOffsetObj = {}, endOffsetObj = {}; |
|
40 prevTabbed.getSelectionBounds(0, startOffsetObj, endOffsetObj); |
|
41 } catch (e) { |
|
42 exceptionCaught = true; |
|
43 } |
|
44 |
|
45 ok(exceptionCaught, "No selection was expected for " + aPrevID); |
|
46 } |
|
47 |
|
48 this.getID = function changeSelection_getID() |
|
49 { |
|
50 return "Hidden selection check for " + aPrevID; |
|
51 } |
|
52 } |
|
53 |
|
54 /** |
|
55 * Do tests |
|
56 */ |
|
57 |
|
58 //gA11yEventDumpToConsole = true; // debug stuff |
|
59 |
|
60 var gQueue = null; |
|
61 function doTests() |
|
62 { |
|
63 gQueue = new eventQueue(); |
|
64 |
|
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")); |
|
69 |
|
70 gQueue.invoke(); // Will call SimpleTest.finish(); |
|
71 } |
|
72 |
|
73 SimpleTest.waitForExplicitFinish(); |
|
74 addA11yLoadEvent(doTests); |
|
75 </script> |
|
76 </head> |
|
77 |
|
78 <body> |
|
79 |
|
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> |
|
89 |
|
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"> |
|
93 |
|
94 </body> |
|
95 </html> |