1
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
3
<title> nsIAccessible Interface Test Case </title>
4
<!-- Descrpt: Test nsIAccessible Interface attributes and methods
5
for HTML SELECT COMBOBOX OPTION Node
6
Author: dsirnapalli@netscape.com
10
- The contents of this file are subject to the Mozilla Public
11
- License Version 1.1 (the "License"); you may not use this file
12
- except in compliance with the License. You may obtain a copy of
13
- the License at http://www.mozilla.org/MPL/
15
- Software distributed under the License is distributed on an "AS
16
- IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
17
- implied. See the License for the specific language governing
18
- rights and limitations under the License.
20
- The Original Code is Mozilla Communicator Test Cases.
22
- The Initial Developer of the Original Code is Netscape Communications
23
- Corp. Portions created by Netscape Communications Corp. are
24
- Copyright (C) 1999 Netscape Communications Corp. All
31
<script type="text/javascript" src="http://www.mozilla.org/quality/embed/jstests/accessibility/jslib/accesslib.js"> </script>
32
<script type="text/javascript" src="http://www.mozilla.org/quality/embed/jstests/accessibility/jslib/bridge.js"> </script>
34
<script type="text/javascript">
36
function getDomNodeSelectComboboxOption()
39
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
40
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
42
var node = document.getElementsByTagName("select").item(0);
43
node = node.firstChild;
47
alert("Exception: " + e);
51
function executeTestCase()
53
var domNode = getDomNodeSelectComboboxOption();
54
domNode.addEventListener('focus',nodeFocused,true);
56
accNode = getAccessibleNode(domNode);
57
tempaccNode = accNode;
59
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
60
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
62
accNode.accTakeFocus();
65
alert("Exception**: " + e);
67
setTimeout("constructResults();", 2000);
70
function constructResults()
73
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
74
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
76
if(tempaccNode.accGetDOMNode() == accNode.accFocused.accGetDOMNode())
78
varaccFocused = "Focused";
82
varaccFocused = "Not Focused";
87
var state = getState();
88
var value = getValue();
89
var newvalue = value.toString();
90
var numActions = getNumActions();
91
var actionName = getActionName();
92
var keyboardShortcut = getAccKeyboardShortcut();
94
var expectedName = "Red";
95
var expectedRole = "34";
96
var expectedState = "3145734";
97
var expectedValue = "NS_ERROR_NOT_IMPLEMENTED";
98
var expectednodeFocus = "Focused";
99
var expectedaccFocused = "Focused";
100
var expectednumActions = 1;
101
var expectedactionName = "Select";
102
var expectedkeyboardShortcut = "Alt+o";
104
var row0 = new Array("Property/Method", "Expected Values", "Actual Values", "Result");
105
var row1 = new Array("Name->", expectedName, name);
106
var row2 = new Array("Role->", expectedRole, role);
107
var row3 = new Array("State->", expectedState, state);
108
var row4 = new Array("Value->", expectedValue, value);
109
var row5 = new Array("accTakeFocus()->", expectednodeFocus, nodeFocus);
110
var row6 = new Array("accFocused->", expectedaccFocused, varaccFocused);
111
var row7 = new Array("accNumActions->", expectednumActions, numActions);
112
var row8 = new Array("getAccActionName()->", expectedactionName, actionName);
113
var row9 = new Array("accKeyboardShortcut->", expectedkeyboardShortcut, keyboardShortcut);
115
row = new Array(row0, row1, row2, row3, row4, row5, row6, row7, row8, row9);
117
if (name == expectedName) row1[3] = "PASS"; else row1[3] = "FAIL";
118
if (role == expectedRole) row2[3] = "PASS"; else row2[3] = "FAIL";
119
if (state == expectedState) row3[3] = "PASS"; else row3[3] = "FAIL";
120
if (newvalue.match(expectedValue)) row4[3] = "PASS"; else row4[3] = "FAIL";
121
if (nodeFocus == expectednodeFocus) row5[3] = "PASS"; else row5[3] = "FAIL";
122
if (varaccFocused == expectedaccFocused) row6[3] = "PASS"; else row6[3] = "FAIL";
123
if (numActions == expectednumActions) row7[3] = "PASS"; else row7[3] = "FAIL";
124
if (actionName == expectedactionName) row8[3] = "PASS"; else row8[3] = "FAIL";
125
if (keyboardShortcut == expectedkeyboardShortcut)
126
row9[3] = "PASS"; else row9[3] = "FAIL";
129
if(!isRunningStandalone())
135
alert("Exception**: " + e);
143
<script type="text/javascript">
144
cookieName = "nsIAccessibleTestSelectComboboxOptionNode";
145
nodeFocus = "Not Focused";
147
res = "<b><u> Results for HTML Select Combobox Option Node:</u></b><br><br>";
149
if(readCookie(cookieName) == null)
151
<!-- Test Select List -->
152
document.write('<b>Testing Select Combobox Option Node..</b>');
153
document.write('<br><br>');
154
document.write('Choose your favorite color ');
155
document.write('<select>');
156
document.write(' <option accesskey="o"> Red </option>');
157
document.write(' <option> Blue </option>');
158
document.write(' <option> Green </option>');
159
document.write(' <option> Yellow </option>');
160
document.write('</select>');
162
setTimeout("executeTestCase();", 2000);
166
var cookieValue = readCookie(cookieName);
167
eraseCookie(cookieName);
168
document.write(cookieValue);
b'\\ No newline at end of file'