|
1 <!DOCTYPE html> |
|
2 <html> |
|
3 <head> |
|
4 <title>Add select options test</title> |
|
5 <link rel="stylesheet" type="text/css" |
|
6 href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
|
7 |
|
8 <script type="application/javascript" |
|
9 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
|
10 |
|
11 <script type="application/javascript" |
|
12 src="../common.js"></script> |
|
13 <script type="application/javascript" |
|
14 src="../role.js"></script> |
|
15 <script type="application/javascript" |
|
16 src="../events.js"></script> |
|
17 |
|
18 <script type="application/javascript"> |
|
19 |
|
20 function addOptions(aID) |
|
21 { |
|
22 this.selectNode = getNode(aID); |
|
23 this.select = getAccessible(this.selectNode); |
|
24 |
|
25 this.invoke = function addOptions_invoke() |
|
26 { |
|
27 for (i = 0; i < 2; i++) { |
|
28 var opt = document.createElement("option"); |
|
29 opt.value = i; |
|
30 opt.text = "Option: Value " + i; |
|
31 |
|
32 this.selectNode.add(opt, null); |
|
33 } |
|
34 } |
|
35 |
|
36 this.eventSeq = [ |
|
37 new invokerChecker(EVENT_REORDER, this.select) |
|
38 ]; |
|
39 |
|
40 this.finalCheck = function addOptions_finalCheck() |
|
41 { |
|
42 var tree = |
|
43 { COMBOBOX: [ |
|
44 { COMBOBOX_LIST: [ |
|
45 { COMBOBOX_OPTION: [ |
|
46 { TEXT_LEAF: [] } |
|
47 ] }, |
|
48 { COMBOBOX_OPTION: [ |
|
49 { TEXT_LEAF: [] } |
|
50 ] } |
|
51 ] } |
|
52 ] }; |
|
53 testAccessibleTree(this.select, tree); |
|
54 } |
|
55 |
|
56 this.getID = function addOptions_getID() |
|
57 { |
|
58 return "test elements insertion into a select"; |
|
59 } |
|
60 } |
|
61 |
|
62 function removeOptions(aID) |
|
63 { |
|
64 this.selectNode = getNode(aID); |
|
65 this.select = getAccessible(this.selectNode); |
|
66 |
|
67 this.invoke = function removeOptions_invoke() |
|
68 { |
|
69 while (this.selectNode.length) |
|
70 this.selectNode.remove(0); |
|
71 } |
|
72 |
|
73 this.eventSeq = [ |
|
74 new invokerChecker(EVENT_REORDER, this.select) |
|
75 ]; |
|
76 |
|
77 this.finalCheck = function removeOptions_finalCheck() |
|
78 { |
|
79 var tree = |
|
80 { COMBOBOX: [ |
|
81 { COMBOBOX_LIST: [] } |
|
82 ] }; |
|
83 testAccessibleTree(this.select, tree); |
|
84 } |
|
85 |
|
86 this.getID = function removeptions_getID() |
|
87 { |
|
88 return "test elements removal from a select"; |
|
89 } |
|
90 } |
|
91 |
|
92 //gA11yEventDumpID = "debug"; |
|
93 |
|
94 function doTest() |
|
95 { |
|
96 gQueue = new eventQueue(); |
|
97 |
|
98 gQueue.push(new addOptions("select")); |
|
99 gQueue.push(new removeOptions("select")); |
|
100 |
|
101 gQueue.invoke(); // Will call SimpleTest.finish(); |
|
102 |
|
103 } |
|
104 |
|
105 SimpleTest.waitForExplicitFinish(); |
|
106 addA11yLoadEvent(doTest); |
|
107 </script> |
|
108 </head> |
|
109 <body> |
|
110 |
|
111 <a target="_blank" |
|
112 href="https://bugzilla.mozilla.org/show_bug.cgi?id=616452" |
|
113 title="Bug 616452 - Dynamically inserted select options aren't reflected in accessible tree"> |
|
114 Mozilla Bug 616452</a> |
|
115 <a target="_blank" |
|
116 href="https://bugzilla.mozilla.org/show_bug.cgi?id=616940" |
|
117 title="Removed select option accessibles aren't removed until hide event is fired"> |
|
118 Mozilla Bug 616940</a> |
|
119 <p id="display"></p> |
|
120 <div id="content" style="display: none"></div> |
|
121 <pre id="test"> |
|
122 </pre> |
|
123 |
|
124 <select id="select"></select> |
|
125 |
|
126 <div id="debug"/> |
|
127 </body> |
|
128 </html> |