| 1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
| 2 |
"http://www.w3.org/TR/html4/strict.dtd"> |
| 3 |
<html> |
| 4 |
<head> |
| 5 |
<title>doh.robot Checkbox a11y Test</title> |
| 6 |
|
| 7 |
<style> |
| 8 |
@import "../../../../util/doh/robot/robot.css"; |
| 9 |
</style> |
| 10 |
|
| 11 |
|
| 12 |
<script type="text/javascript" src="../../../../dojo/dojo.js"></script> |
| 13 |
|
| 14 |
<script type="text/javascript"> |
| 15 |
dojo.require("dijit.robotx"); |
| 16 |
dojo.require("dijit.tests.helpers"); // functions to help test |
| 17 |
|
| 18 |
dojo.ready(function(){ |
| 19 |
doh.robot.initRobot('../test_CheckBox.html'); |
| 20 |
|
| 21 |
doh.register("Checkbox a11y",[ |
| 22 |
{ |
| 23 |
timeout:5000, |
| 24 |
name:"uncheck cb0 a11y", |
| 25 |
runTest:function(){ |
| 26 |
var d = new doh.Deferred(); |
| 27 |
|
| 28 |
dijit.byId("cb1").focus(); |
| 29 |
doh.robot.keyPress(dojo.keys.TAB, 500, { |
| 30 |
shift: true |
| 31 |
}); |
| 32 |
doh.robot.keyPress(dojo.keys.SPACE, 1000); |
| 33 |
|
| 34 |
doh.robot.sequence(d.getTestCallback(function(){ |
| 35 |
doh.f(dojo.byId('cb0').checked, "cb0 was checked"); |
| 36 |
}), 1000); |
| 37 |
|
| 38 |
return d; |
| 39 |
} |
| 40 |
}, |
| 41 |
{ |
| 42 |
timeout:5000, |
| 43 |
name:"check cb1 a11y", |
| 44 |
runTest:function(){ |
| 45 |
var d = new doh.Deferred(); |
| 46 |
|
| 47 |
doh.robot.keyPress(dojo.keys.TAB, 500); |
| 48 |
doh.robot.keyPress(dojo.keys.SPACE, 1000); |
| 49 |
|
| 50 |
doh.robot.sequence(d.getTestCallback(function(){ |
| 51 |
doh.t(dijit.byId('cb1').checked, "cb1 was not checked"); |
| 52 |
doh.is("true", dojo.byId('cb1').getAttribute("aria-checked"), "aria-checked"); |
| 53 |
}), 1000); |
| 54 |
|
| 55 |
return d; |
| 56 |
} |
| 57 |
}, |
| 58 |
{ |
| 59 |
timeout:7000, |
| 60 |
name:"uncheck cb2 a11y", |
| 61 |
runTest:function(){ |
| 62 |
var d = new doh.Deferred(); |
| 63 |
|
| 64 |
doh.robot.keyPress(dojo.keys.TAB, 500); |
| 65 |
doh.robot.keyPress(dojo.keys.TAB, 1000); |
| 66 |
doh.robot.keyPress(dojo.keys.SPACE, 1000); |
| 67 |
|
| 68 |
doh.robot.sequence(d.getTestCallback(function(){ |
| 69 |
doh.f(dijit.byId('cb2').checked, "cb2 was checked"); |
| 70 |
doh.is("false", dojo.byId('cb2').getAttribute("aria-checked"), "aria-checked"); |
| 71 |
}), 1000); |
| 72 |
|
| 73 |
return d; |
| 74 |
} |
| 75 |
}, |
| 76 |
{ |
| 77 |
timeout:7000, |
| 78 |
name:"cb4 readonly a11y", |
| 79 |
runTest:function(){ |
| 80 |
var d = new doh.Deferred(); |
| 81 |
|
| 82 |
doh.robot.keyPress(dojo.keys.TAB, 500); |
| 83 |
doh.robot.keyPress(dojo.keys.TAB, 1000); |
| 84 |
doh.robot.keyPress(dojo.keys.SPACE, 1000); |
| 85 |
|
| 86 |
doh.robot.sequence(d.getTestCallback(function(){ |
| 87 |
doh.t(dijit.byId('cb4').checked, "cb4 was not checked"); |
| 88 |
doh.is("true", dojo.byId('cb4').getAttribute("aria-checked"), "aria-checked"); |
| 89 |
}), 1000); |
| 90 |
|
| 91 |
return d; |
| 92 |
} |
| 93 |
}, |
| 94 |
{ |
| 95 |
timeout:9000, |
| 96 |
name:"cb6 uncheck a11y", |
| 97 |
runTest:function(){ |
| 98 |
var d = new doh.Deferred(); |
| 99 |
|
| 100 |
doh.robot.keyPress(dojo.keys.TAB, 500); |
| 101 |
doh.robot.keyPress(dojo.keys.TAB, 1000); |
| 102 |
doh.robot.keyPress(dojo.keys.TAB, 1000); |
| 103 |
doh.robot.keyPress(dojo.keys.SPACE, 1000); |
| 104 |
|
| 105 |
doh.robot.sequence(d.getTestCallback(function(){ |
| 106 |
doh.f(dijit.byId('cb6').checked, "cb6 was checked"); |
| 107 |
doh.is("false", dojo.byId('cb6').getAttribute("aria-checked"), "aria-checked"); |
| 108 |
}), 1000); |
| 109 |
|
| 110 |
return d; |
| 111 |
} |
| 112 |
}, |
| 113 |
{ |
| 114 |
timeout:3000, |
| 115 |
name:"cb6 check a11y", |
| 116 |
runTest:function(){ |
| 117 |
var d = new doh.Deferred(); |
| 118 |
|
| 119 |
doh.robot.keyPress(dojo.keys.SPACE, 500); |
| 120 |
|
| 121 |
doh.robot.sequence(d.getTestCallback(function(){ |
| 122 |
doh.t(dijit.byId('cb6').checked, "cb6 was not checked"); |
| 123 |
doh.is("true", dojo.byId('cb6').getAttribute("aria-checked"), "aria-checked"); |
| 124 |
}), 1000); |
| 125 |
|
| 126 |
return d; |
| 127 |
} |
| 128 |
} |
| 129 |
]); |
| 130 |
|
| 131 |
doh.register("Radio button a11y",[ |
| 132 |
{ |
| 133 |
name: "reset blank value", |
| 134 |
runTest: function(){ |
| 135 |
doh.is("", dijit.byId('g1rb3').params.value, "blank parameter"); |
| 136 |
doh.is("", dijit.byId('g1rb3').value, "initially blank"); |
| 137 |
dijit.byId('g1rb3').reset(); |
| 138 |
doh.is("", dijit.byId('g1rb3').value, "blank after reset"); |
| 139 |
} |
| 140 |
}, |
| 141 |
{ |
| 142 |
timeout: 5000, |
| 143 |
name: "initial tab order", |
| 144 |
runTest: function(){ |
| 145 |
var d = new doh.Deferred(); |
| 146 |
|
| 147 |
dojo.byId("enableWeatherButton").focus(); |
| 148 |
doh.robot.keyPress(dojo.keys.TAB, 500, { |
| 149 |
shift: true |
| 150 |
}); |
| 151 |
doh.robot.keyPress(dojo.keys.TAB, 500, { |
| 152 |
shift: true |
| 153 |
}); |
| 154 |
doh.robot.keyPress(dojo.keys.TAB, 500, {}); |
| 155 |
doh.robot.keyPress(dojo.keys.SPACE, 500); |
| 156 |
|
| 157 |
doh.robot.sequence(d.getTestCallback(function(){ |
| 158 |
doh.t(dijit.byId('g1rb2').checked, "talk should have been checked"); |
| 159 |
}), 500); |
| 160 |
|
| 161 |
return d; |
| 162 |
} |
| 163 |
}, |
| 164 |
{ |
| 165 |
timeout:6000, |
| 166 |
name:"weather enabled a11y", |
| 167 |
runTest:function(){ |
| 168 |
var d = new doh.Deferred(); |
| 169 |
|
| 170 |
dijit.byId("g1rb2").focus(); |
| 171 |
dijit.byId("g1rb3").set("disabled",false); |
| 172 |
doh.robot.keyPress(dojo.keys.RIGHT_ARROW, 1000); |
| 173 |
|
| 174 |
doh.robot.sequence(d.getTestCallback(function(){ |
| 175 |
doh.f(dijit.byId('g1rb1').checked, "news was checked"); |
| 176 |
doh.f(dijit.byId('g1rb2').checked, "talk was checked"); |
| 177 |
doh.t(dijit.byId('g1rb3').checked, "weather was not checked"); |
| 178 |
doh.is("false", dojo.byId('g1rb1').getAttribute("aria-checked")||"false", "aria-checked 1"); |
| 179 |
doh.is("false", dojo.byId('g1rb2').getAttribute("aria-checked")||"false", "aria-checked 2"); |
| 180 |
doh.is("true", dojo.byId('g1rb3').getAttribute("aria-checked"), "aria-checked 3"); |
| 181 |
}), 1000); |
| 182 |
|
| 183 |
return d; |
| 184 |
} |
| 185 |
}, |
| 186 |
{ |
| 187 |
timeout: 5000, |
| 188 |
name: "changed tab order", |
| 189 |
runTest: function(){ |
| 190 |
var d = new doh.Deferred(); |
| 191 |
|
| 192 |
dojo.byId("enableWeatherButton").focus(); |
| 193 |
doh.robot.keyPress(dojo.keys.TAB, 500, { |
| 194 |
shift: true |
| 195 |
}); |
| 196 |
doh.robot.keyPress(dojo.keys.TAB, 500, { |
| 197 |
shift: true |
| 198 |
}); |
| 199 |
doh.robot.keyPress(dojo.keys.TAB, 500, {}); |
| 200 |
doh.robot.keyPress(dojo.keys.LEFT_ARROW, 500); |
| 201 |
|
| 202 |
doh.robot.sequence(d.getTestCallback(function(){ |
| 203 |
doh.t(dijit.byId('g1rb2').checked, "talk should have been checked"); |
| 204 |
}), 500); |
| 205 |
|
| 206 |
return d; |
| 207 |
} |
| 208 |
}, |
| 209 |
{ |
| 210 |
timeout:6000, |
| 211 |
name:"change value to country a11y", |
| 212 |
runTest:function(){ |
| 213 |
var d = new doh.Deferred(); |
| 214 |
|
| 215 |
dijit.byId("g2rb1").focus(); |
| 216 |
doh.robot.keyPress(dojo.keys.RIGHT_ARROW, 1000); |
| 217 |
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500); |
| 218 |
doh.robot.keyPress(dojo.keys.SPACE, 500); |
| 219 |
|
| 220 |
doh.robot.sequence(d.getTestCallback(function(){ |
| 221 |
doh.t(dijit.byId('g2rb3').checked, "country was not checked"); |
| 222 |
doh.f(dijit.byId('g2rb2').checked, "oldies was checked"); |
| 223 |
doh.f(dijit.byId('g2rb1').checked, "top 40 was checked"); |
| 224 |
doh.is("false", dojo.byId('g2rb1').getAttribute("aria-checked")||"false", "aria-checked 1"); |
| 225 |
doh.is("false", dojo.byId('g2rb2').getAttribute("aria-checked")||"false", "aria-checked 2"); |
| 226 |
doh.is("true", dojo.byId('g2rb3').getAttribute("aria-checked"), "aria-checked 3"); |
| 227 |
}), 1000); |
| 228 |
|
| 229 |
return d; |
| 230 |
} |
| 231 |
}, |
| 232 |
{ |
| 233 |
timeout:4000, |
| 234 |
name:"change value to top 40 a11y", |
| 235 |
runTest:function(){ |
| 236 |
var d = new doh.Deferred(); |
| 237 |
|
| 238 |
doh.robot.keyPress(dojo.keys.UP_ARROW, 500); |
| 239 |
doh.robot.keyPress(dojo.keys.LEFT_ARROW, 500); |
| 240 |
|
| 241 |
doh.robot.sequence(d.getTestCallback(function(){ |
| 242 |
doh.f(dijit.byId('g2rb3').checked, "country was checked"); |
| 243 |
doh.f(dijit.byId('g2rb2').checked, "oldies was checked"); |
| 244 |
doh.t(dijit.byId('g2rb1').checked, "top 40 was not checked"); |
| 245 |
doh.is("true", dojo.byId('g2rb1').getAttribute("aria-checked"), "aria-checked 1"); |
| 246 |
doh.is("false", dojo.byId('g2rb2').getAttribute("aria-checked")||"false", "aria-checked 2"); |
| 247 |
doh.is("false", dojo.byId('g2rb3').getAttribute("aria-checked")||"false", "aria-checked 3"); |
| 248 |
}), 1000); |
| 249 |
|
| 250 |
return d; |
| 251 |
} |
| 252 |
}, |
| 253 |
{ |
| 254 |
timeout:11000, |
| 255 |
name:"enable b1 a11y", |
| 256 |
runTest:function(){ |
| 257 |
var d = new doh.Deferred(); |
| 258 |
|
| 259 |
doh.robot.keyPress(dojo.keys.TAB, 500); |
| 260 |
doh.robot.keyPress(dojo.keys.TAB, 1000); |
| 261 |
doh.robot.keyPress(dojo.keys.TAB, 1000); |
| 262 |
doh.robot.keyPress(dojo.keys.TAB, 1000); |
| 263 |
doh.robot.keyPress(dojo.keys.SPACE, 1000); |
| 264 |
|
| 265 |
doh.robot.sequence(d.getTestCallback(function(){ |
| 266 |
doh.t(dijit.byId('b1').checked, "b1 was not checked"); |
| 267 |
doh.f(dijit.byId('b2').checked, "b2 was checked"); |
| 268 |
doh.f(dijit.byId('c1').checked, "c1 was checked"); |
| 269 |
doh.f(dijit.byId('c2').checked, "c2 was checked"); |
| 270 |
doh.f(dijit.byId('d1').checked, "d1 was checked"); |
| 271 |
doh.f(dijit.byId('d2').checked, "d2 was checked"); |
| 272 |
}), 1000); |
| 273 |
|
| 274 |
return d; |
| 275 |
} |
| 276 |
}, |
| 277 |
{ |
| 278 |
timeout:3000, |
| 279 |
name:"enable b2 a11y", |
| 280 |
runTest:function(){ |
| 281 |
var d = new doh.Deferred(); |
| 282 |
|
| 283 |
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 500); |
| 284 |
|
| 285 |
doh.robot.sequence(d.getTestCallback(function(){ |
| 286 |
doh.f(dijit.byId('b1').checked, "b1 was checked"); |
| 287 |
doh.t(dijit.byId('b2').checked, "b2 was not checked"); |
| 288 |
doh.f(dijit.byId('c1').checked, "c1 was checked"); |
| 289 |
doh.f(dijit.byId('c2').checked, "c2 was checked"); |
| 290 |
doh.f(dijit.byId('d1').checked, "d1 was checked"); |
| 291 |
doh.f(dijit.byId('d2').checked, "d2 was checked"); |
| 292 |
}), 1000); |
| 293 |
|
| 294 |
return d; |
| 295 |
} |
| 296 |
}, |
| 297 |
{ |
| 298 |
timeout:5000, |
| 299 |
name:"enable c1 a11y", |
| 300 |
runTest:function(){ |
| 301 |
var d = new doh.Deferred(); |
| 302 |
|
| 303 |
doh.robot.keyPress(dojo.keys.TAB, 500); |
| 304 |
doh.robot.keyPress(dojo.keys.SPACE, 1000); |
| 305 |
|
| 306 |
doh.robot.sequence(d.getTestCallback(function(){ |
| 307 |
doh.f(dijit.byId('b1').checked, "b1 was checked"); |
| 308 |
doh.t(dijit.byId('b2').checked, "b2 was not checked"); |
| 309 |
doh.t(dijit.byId('c1').checked, "c1 was not checked"); |
| 310 |
doh.f(dijit.byId('c2').checked, "c2 was checked"); |
| 311 |
doh.f(dijit.byId('d1').checked, "d1 was checked"); |
| 312 |
doh.f(dijit.byId('d2').checked, "d2 was checked"); |
| 313 |
}), 1000); |
| 314 |
|
| 315 |
return d; |
| 316 |
} |
| 317 |
}, |
| 318 |
{ |
| 319 |
timeout:3000, |
| 320 |
name:"enable c2 a11y", |
| 321 |
runTest:function(){ |
| 322 |
var d = new doh.Deferred(); |
| 323 |
|
| 324 |
doh.robot.keyPress(dojo.keys.RIGHT_ARROW, 500); |
| 325 |
|
| 326 |
doh.robot.sequence(d.getTestCallback(function(){ |
| 327 |
doh.f(dijit.byId('b1').checked, "b1 was checked"); |
| 328 |
doh.t(dijit.byId('b2').checked, "b2 was not checked"); |
| 329 |
doh.f(dijit.byId('c1').checked, "c1 was checked"); |
| 330 |
doh.t(dijit.byId('c2').checked, "c2 was not checked"); |
| 331 |
doh.f(dijit.byId('d1').checked, "d1 was checked"); |
| 332 |
doh.f(dijit.byId('d2').checked, "d2 was checked"); |
| 333 |
}), 1000); |
| 334 |
|
| 335 |
return d; |
| 336 |
} |
| 337 |
}, |
| 338 |
{ |
| 339 |
timeout:6000, |
| 340 |
name:"enable d2 a11y", |
| 341 |
runTest:function(){ |
| 342 |
var d = new doh.Deferred(); |
| 343 |
|
| 344 |
doh.robot.keyPress(dojo.keys.TAB, 500); |
| 345 |
doh.robot.keyPress(dojo.keys.RIGHT_ARROW, 1000); |
| 346 |
doh.robot.keyPress(dojo.keys.SPACE, 500); |
| 347 |
|
| 348 |
doh.robot.sequence(d.getTestCallback(function(){ |
| 349 |
doh.f(dijit.byId('b1').checked, "b1 was checked"); |
| 350 |
doh.t(dijit.byId('b2').checked, "b2 was not checked"); |
| 351 |
doh.f(dijit.byId('c1').checked, "c1 was checked"); |
| 352 |
doh.t(dijit.byId('c2').checked, "c2 was not checked"); |
| 353 |
doh.f(dijit.byId('d1').checked, "d1 was checked"); |
| 354 |
doh.t(dijit.byId('d2').checked, "d2 was not checked"); |
| 355 |
}), 1000); |
| 356 |
|
| 357 |
return d; |
| 358 |
} |
| 359 |
}, |
| 360 |
{ |
| 361 |
timeout:3000, |
| 362 |
name:"enable d1 a11y", |
| 363 |
runTest:function(){ |
| 364 |
var d = new doh.Deferred(); |
| 365 |
|
| 366 |
doh.robot.keyPress(dojo.keys.UP_ARROW, 500); |
| 367 |
|
| 368 |
doh.robot.sequence(d.getTestCallback(function(){ |
| 369 |
doh.f(dijit.byId('b1').checked, "b1 was checked"); |
| 370 |
doh.t(dijit.byId('b2').checked, "b2 was not checked"); |
| 371 |
doh.f(dijit.byId('c1').checked, "c1 was checked"); |
| 372 |
doh.t(dijit.byId('c2').checked, "c2 was not checked"); |
| 373 |
doh.t(dijit.byId('d1').checked, "d1 was not checked"); |
| 374 |
doh.f(dijit.byId('d2').checked, "d2 was checked"); |
| 375 |
}), 1000); |
| 376 |
|
| 377 |
return d; |
| 378 |
} |
| 379 |
}, |
| 380 |
{ |
| 381 |
timeout:5000, |
| 382 |
name:"enable coffee a11y", |
| 383 |
runTest:function(){ |
| 384 |
var d = new doh.Deferred(); |
| 385 |
|
| 386 |
doh.robot.keyPress(dojo.keys.TAB, 500); |
| 387 |
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 1000); |
| 388 |
|
| 389 |
doh.robot.sequence(d.getTestCallback(function(){ |
| 390 |
doh.f(dijit.byId('g4rb1').checked, "tea was checked"); |
| 391 |
doh.t(dijit.byId('g4rb2').checked, "coffee was not checked"); |
| 392 |
}), 1000); |
| 393 |
|
| 394 |
return d; |
| 395 |
} |
| 396 |
} |
| 397 |
]); |
| 398 |
|
| 399 |
doh.run(); |
| 400 |
}); |
| 401 |
</script> |
| 402 |
</head> |
| 403 |
</html> |