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 CHECKBOX UNCHECKED 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 getDomNodeCheckBoxUnchecked()
39
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
40
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
42
var node = document.getElementsByTagName("form").item(0);
48
alert("Exception: " + e);
52
function executeTestCase()
54
var domNode = getDomNodeCheckBoxUnchecked();
55
domNode.addEventListener('focus',nodeFocused,true);
56
domNode.addEventListener('click', nodeChecked,true);
58
accNode = getAccessibleNode(domNode);
59
tempaccNode = accNode;
61
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
62
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
64
accNode.accTakeFocus();
67
alert("Exception**: " + e);
69
setTimeout("constructResults();", 2000);
72
function nodeChecked()
74
nodeCheck = "Check Box Checked";
77
function constructResults()
80
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
81
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
83
if(tempaccNode.accGetDOMNode() == accNode.accFocused.accGetDOMNode())
85
varaccFocused = "Focused";
89
varaccFocused = "Not Focused";
94
var state = getState();
95
var value = getValue();
96
var newvalue = value.toString();
97
var numActions = getNumActions();
99
alert("When i last modified the test case numActions was 1. Now numActions is more than 1. Add tests for other numActions");
100
var actionName = getActionName();
101
var action = doAction();
102
var keyboardShortcut = getAccKeyboardShortcut();
104
var expectedName = null;
105
var expectedRole = "44";
106
var expectedState = "1048580";
107
var expectedValue = "NS_ERROR_NOT_IMPLEMENTED";
108
var expectednodeFocus = "Focused";
109
var expectedaccFocused = "Focused";
110
var expectednumActions = "1";
111
var expectedactionName = "Check";
112
var expectednodeCheck = "Check Box Checked";
113
var expectedkeyboardShortcut = "Alt+c";
115
var row0 = new Array("Property/Method", "Expected Values", "Actual Values", "Result");
116
var row1 = new Array("Name->", expectedName, name);
117
var row2 = new Array("Role->", expectedRole, role);
118
var row3 = new Array("State->", expectedState, state);
119
var row4 = new Array("Value->", expectedValue, value);
120
var row5 = new Array("accTakeFocus()->", expectednodeFocus, nodeFocus);
121
var row6 = new Array("accFocused->", expectedaccFocused, varaccFocused);
122
var row7 = new Array("accNumActions->", expectednumActions, numActions);
123
var row8 = new Array("getAccActionName()->", expectedactionName, actionName);
124
var row9 = new Array("accDoAction()->", expectednodeCheck, nodeCheck);
125
var row10 = new Array("accKeyboardShortcut->", expectedkeyboardShortcut, keyboardShortcut);
127
row = new Array(row0, row1, row2, row3, row4, row5, row6, row7, row8, row9, row10);
129
if (name == expectedName) row1[3] = "PASS"; else row1[3] = "FAIL";
130
if (role == expectedRole) row2[3] = "PASS"; else row2[3] = "FAIL";
131
if (state == expectedState) row3[3] = "PASS"; else row3[3] = "FAIL";
132
if (newvalue.match(expectedValue)) row4[3] = "PASS"; else row4[3] = "FAIL";
133
if (nodeFocus == expectednodeFocus) row5[3] = "PASS"; else row5[3] = "FAIL";
134
if (varaccFocused == expectedaccFocused) row6[3] = "PASS"; else row6[3] = "FAIL";
135
if (numActions == expectednumActions) row7[3] = "PASS"; else row7[3] = "FAIL";
136
if (actionName == expectedactionName) row8[3] = "PASS"; else row8[3] = "FAIL";
137
if (nodeCheck == expectednodeCheck) row9[3] = "PASS"; else row9[3] = "FAIL";
138
if (keyboardShortcut == expectedkeyboardShortcut)
139
row10[3] = "PASS"; else row10[3] = "FAIL";
142
if(!isRunningStandalone())
148
alert("Exception**: " + e);
156
<script type="text/javascript">
157
nodeFocus = "Not Focused";
158
nodeCheck = "Check Box Not Checked";
159
cookieName = "nsIAccessibleTestCheckBoxNode";
160
var res = "<b><u> Results for HTML Check Box Unchecked Node:</u></b><br><br>";
162
if(readCookie(cookieName) == null)
165
document.write('<br><br><b> Testing Check Box Unchecked for Accessibility </b><br><br>');
166
document.write('<form>');
168
document.write('Is your age: <br>');
169
document.write('<input type="checkbox" name="sex" accesskey="c"> Above 30');
170
document.write('<input type="checkbox" name="sex"> Below 30');
172
document.write('</form>');
174
setTimeout("executeTestCase();", 2000);
178
var cookieValue = readCookie(cookieName);
179
eraseCookie(cookieName);
180
document.write(cookieValue);