~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/embedding/qa/jstests/accessibility/html/htmlcheckboxunchecked.html

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
 
2
<html>
 
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
 
7
     Created:01.18.02
 
8
     Last Updated:06.25.02.
 
9
 
 
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/
 
14
   -
 
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.
 
19
   -
 
20
   - The Original Code is Mozilla Communicator Test Cases.
 
21
   -
 
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
 
25
   - Rights Reserved.
 
26
   -
 
27
   - Contributor(s):
 
28
  -->
 
29
<head>
 
30
 
 
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>
 
33
 
 
34
<script type="text/javascript">
 
35
 
 
36
function getDomNodeCheckBoxUnchecked()
 
37
{
 
38
 try{
 
39
  netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
 
40
  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
 
41
 
 
42
  var node = document.getElementsByTagName("form").item(0);
 
43
  arr = new Array(5);
 
44
  arr = node.elements;
 
45
  return arr[0];
 
46
 }
 
47
 catch(e){
 
48
  alert("Exception: " + e);
 
49
 }
 
50
}
 
51
 
 
52
function executeTestCase()
 
53
{
 
54
  var domNode = getDomNodeCheckBoxUnchecked();
 
55
  domNode.addEventListener('focus',nodeFocused,true);
 
56
  domNode.addEventListener('click', nodeChecked,true);
 
57
 
 
58
  accNode = getAccessibleNode(domNode);
 
59
  tempaccNode = accNode;
 
60
  try{
 
61
    netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
 
62
    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
 
63
 
 
64
    accNode.accTakeFocus();
 
65
  }
 
66
  catch(e){
 
67
    alert("Exception**: " + e);
 
68
  }
 
69
  setTimeout("constructResults();", 2000);
 
70
}
 
71
 
 
72
function nodeChecked()
 
73
{
 
74
  nodeCheck = "Check Box Checked";
 
75
}
 
76
 
 
77
function constructResults()
 
78
{
 
79
 try{
 
80
  netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
 
81
  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
 
82
 
 
83
  if(tempaccNode.accGetDOMNode() == accNode.accFocused.accGetDOMNode())
 
84
  {
 
85
    varaccFocused = "Focused";
 
86
  }
 
87
  else
 
88
  {
 
89
    varaccFocused = "Not Focused";
 
90
  }
 
91
 
 
92
  var name = getName();
 
93
  var role = getRole();
 
94
  var state = getState();
 
95
  var value = getValue();
 
96
  var newvalue = value.toString();
 
97
  var numActions = getNumActions();
 
98
  if(numActions > 1)
 
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();
 
103
 
 
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";
 
114
 
 
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);
 
126
 
 
127
  row = new Array(row0, row1, row2, row3, row4, row5, row6, row7, row8, row9, row10);
 
128
 
 
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";
 
140
 
 
141
  appendTableRes();
 
142
  if(!isRunningStandalone())
 
143
    WriteResults(res);
 
144
  else
 
145
    submitToCookie();
 
146
 }
 
147
 catch(e){
 
148
  alert("Exception**: " + e);
 
149
 }
 
150
}
 
151
 
 
152
</script>
 
153
</head>
 
154
<body>
 
155
 
 
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>";
 
161
 
 
162
if(readCookie(cookieName) == null)
 
163
{
 
164
 <!-- Test Form -->
 
165
  document.write('<br><br><b> Testing Check Box Unchecked for Accessibility </b><br><br>');
 
166
  document.write('<form>');
 
167
 
 
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');
 
171
 
 
172
  document.write('</form>');
 
173
 
 
174
  setTimeout("executeTestCase();", 2000);
 
175
}
 
176
else
 
177
{
 
178
  var cookieValue = readCookie(cookieName);
 
179
  eraseCookie(cookieName);
 
180
  document.write(cookieValue);
 
181
}
 
182
 
 
183
</script>
 
184
</body>
 
185
</html>
 
186
 
 
187
 
 
188