|
1 <html> |
|
2 |
|
3 <head> |
|
4 <title>nsIAccessible::takeFocus testing</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 |
|
12 <script type="application/javascript" |
|
13 src="../common.js"></script> |
|
14 <script type="application/javascript" |
|
15 src="../role.js"></script> |
|
16 <script type="application/javascript" |
|
17 src="../states.js"></script> |
|
18 <script type="application/javascript" |
|
19 src="../events.js"></script> |
|
20 |
|
21 <script type="application/javascript"> |
|
22 //////////////////////////////////////////////////////////////////////////// |
|
23 // Invokers |
|
24 |
|
25 function takeFocusInvoker(aID) |
|
26 { |
|
27 this.accessible = getAccessible(aID); |
|
28 |
|
29 this.eventSeq = [ new focusChecker(this.accessible) ]; |
|
30 |
|
31 this.invoke = function takeFocusInvoker_invoke() |
|
32 { |
|
33 this.accessible.takeFocus(); |
|
34 } |
|
35 |
|
36 this.getID = function takeFocusInvoker_getID() |
|
37 { |
|
38 return "takeFocus for " + prettyName(aID); |
|
39 } |
|
40 } |
|
41 |
|
42 //////////////////////////////////////////////////////////////////////////// |
|
43 // Test |
|
44 |
|
45 //gA11yEventDumpToConsole = true; // debug stuff |
|
46 |
|
47 var gQueue = null; |
|
48 function doTest() |
|
49 { |
|
50 disableLogging(); // from test_focusedChild |
|
51 gQueue = new eventQueue(); |
|
52 |
|
53 gQueue.push(new takeFocusInvoker("aria-link")); |
|
54 gQueue.push(new takeFocusInvoker("aria-link2")); |
|
55 gQueue.push(new takeFocusInvoker("link")); |
|
56 gQueue.push(new takeFocusInvoker("item2")); |
|
57 gQueue.push(new takeFocusInvoker("plugin")); |
|
58 gQueue.push(new takeFocusInvoker(document)); |
|
59 gQueue.push(new takeFocusInvoker("lb_item2")); |
|
60 gQueue.push(new takeFocusInvoker(document)); |
|
61 gQueue.push(new takeFocusInvoker("lb_item3.2")); |
|
62 gQueue.push(new takeFocusInvoker(document)); |
|
63 gQueue.push(new takeFocusInvoker("lb_item3.1")); |
|
64 |
|
65 gQueue.invoke(); // Will call SimpleTest.finish(); |
|
66 } |
|
67 |
|
68 function waitForPlugin() |
|
69 { |
|
70 window.setTimeout((isAccessible("plugin") ? doTest : waitForPlugin), 0); |
|
71 } |
|
72 |
|
73 SimpleTest.waitForExplicitFinish(); |
|
74 setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED); |
|
75 addA11yLoadEvent(waitForPlugin); |
|
76 </script> |
|
77 </head> |
|
78 |
|
79 <body> |
|
80 |
|
81 <a target="_blank" |
|
82 href="https://bugzilla.mozilla.org/show_bug.cgi?id=429547" |
|
83 title="Support aria-activedescendant usage in nsIAccesible::TakeFocus()"> |
|
84 Mozilla Bug 429547 |
|
85 </a> |
|
86 <a target="_blank" |
|
87 href="https://bugzilla.mozilla.org/show_bug.cgi?id=452710" |
|
88 title="nsIAccessible::takeFocus testing"> |
|
89 Mozilla Bug 452710 |
|
90 </a> |
|
91 <a target="_blank" |
|
92 href="https://bugzilla.mozilla.org/show_bug.cgi?id=646361" |
|
93 title="No focus event fired on document when focus is set to the document while focused in a plugin"> |
|
94 Mozilla Bug 646361 |
|
95 </a> |
|
96 <a target="_blank" |
|
97 href="https://bugzilla.mozilla.org/show_bug.cgi?id=706067" |
|
98 title="Make takeFocus work on widget items"> |
|
99 Mozilla Bug 706067 |
|
100 </a> |
|
101 <p id="display"></p> |
|
102 <div id="content" style="display: none"></div> |
|
103 <pre id="test"> |
|
104 </pre> |
|
105 |
|
106 <span id="aria-link" role="link" tabindex="0">link</span> |
|
107 <span id="aria-link2" role="link" tabindex="0">link</span> |
|
108 |
|
109 <a id="link" href="">link</a> |
|
110 |
|
111 <div role="listbox" aria-activedescendant="item1" id="container" tabindex="1"> |
|
112 <div role="option" id="item1">item1</div> |
|
113 <div role="option" id="item2">item2</div> |
|
114 <div role="option" id="item3">item3</div> |
|
115 </div> |
|
116 |
|
117 <embed id="plugin" type="application/x-test" width="200" height="200" wmode="window"></embed> |
|
118 |
|
119 <select id="listbox" size="5"> |
|
120 <option id="lb_item1">item1</option> |
|
121 <option id="lb_item2">item2</option> |
|
122 <optgroup> |
|
123 <option id="lb_item3.1">item 3.1</option> |
|
124 <option id="lb_item3.2">item 3.2</option> |
|
125 </optgroup> |
|
126 </select> |
|
127 </body> |
|
128 </html> |