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

« back to all changes in this revision

Viewing changes to mozilla/embedding/qa/jstests/accessibility/html/htmlselectoption.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 SELECT COMBOBOX OPTION Node
 
6
     Author: dsirnapalli@netscape.com
 
7
     Created:03.27.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 getDomNodeSelectComboboxOption()
 
37
{
 
38
 try{
 
39
  netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
 
40
  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
 
41
 
 
42
  var node = document.getElementsByTagName("select").item(0);
 
43
  node = node.firstChild;
 
44
  return node;
 
45
 }
 
46
 catch(e){
 
47
  alert("Exception: " + e);
 
48
 }
 
49
}
 
50
 
 
51
function executeTestCase()
 
52
{
 
53
  var domNode = getDomNodeSelectComboboxOption();
 
54
  domNode.addEventListener('focus',nodeFocused,true);
 
55
 
 
56
  accNode = getAccessibleNode(domNode);
 
57
  tempaccNode = accNode;
 
58
  try{
 
59
    netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
 
60
    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
 
61
 
 
62
    accNode.accTakeFocus();
 
63
  }
 
64
  catch(e){
 
65
    alert("Exception**: " + e);
 
66
  }
 
67
  setTimeout("constructResults();", 2000);
 
68
}
 
69
 
 
70
function constructResults()
 
71
{
 
72
 try{
 
73
  netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
 
74
  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
 
75
 
 
76
  if(tempaccNode.accGetDOMNode() == accNode.accFocused.accGetDOMNode())
 
77
  {
 
78
    varaccFocused = "Focused";
 
79
  }
 
80
  else
 
81
  {
 
82
    varaccFocused = "Not Focused";
 
83
  }
 
84
 
 
85
  var name = getName();
 
86
  var role = getRole();
 
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();
 
93
 
 
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";
 
103
 
 
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);
 
114
 
 
115
  row = new Array(row0, row1, row2, row3, row4, row5, row6, row7, row8, row9);
 
116
 
 
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";
 
127
 
 
128
  appendTableRes();
 
129
  if(!isRunningStandalone())
 
130
    WriteResults(res);
 
131
  else
 
132
    submitToCookie();
 
133
 }
 
134
 catch(e){
 
135
  alert("Exception**: " + e);
 
136
 }
 
137
}
 
138
 
 
139
</script>
 
140
</head>
 
141
<body>
 
142
 
 
143
<script type="text/javascript">
 
144
cookieName = "nsIAccessibleTestSelectComboboxOptionNode";
 
145
nodeFocus = "Not Focused";
 
146
 
 
147
res = "<b><u> Results for HTML Select Combobox Option Node:</u></b><br><br>";
 
148
 
 
149
if(readCookie(cookieName) == null)
 
150
{
 
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>');
 
161
 
 
162
  setTimeout("executeTestCase();", 2000);
 
163
}
 
164
else
 
165
{
 
166
  var cookieValue = readCookie(cookieName);
 
167
  eraseCookie(cookieName);
 
168
  document.write(cookieValue);
 
169
}
 
170
 
 
171
</script>
 
172
</body>
 
173
</html>
 
 
b'\\ No newline at end of file'