| 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>robot Fieldset 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" |
| 13 |
data-dojo-config="isDebug: true"></script> |
| 14 |
|
| 15 |
<script type="text/javascript"> |
| 16 |
require([ |
| 17 |
"doh/runner", "dojo/robotx", |
| 18 |
"dojo/dom", "dojo/keys", |
| 19 |
"dijit/tests/helpers", "dojo/domReady!" |
| 20 |
], function(doh, robot, dom, keys, helpers){ |
| 21 |
|
| 22 |
robot.initRobot('../test_Fieldset.html'); |
| 23 |
|
| 24 |
doh.register(function setup(){ |
| 25 |
// get pointer to registry in the iframe |
| 26 |
registry = robot.window.require("dijit/registry"); |
| 27 |
dfocus = robot.window.require("dijit/focus"); |
| 28 |
}); |
| 29 |
|
| 30 |
doh.register("keyboard", [ |
| 31 |
{ |
| 32 |
name: "tabbing", |
| 33 |
timeout: 20000, |
| 34 |
runTest: function(){ |
| 35 |
var d = new doh.Deferred(); |
| 36 |
|
| 37 |
dom.byId("first", robot.document).focus(); |
| 38 |
|
| 39 |
// go to first legend |
| 40 |
robot.keyPress(keys.TAB, 500, {}); |
| 41 |
robot.sequence(d.getTestErrback(function(){ |
| 42 |
doh.is("Fieldset 1", helpers.innerText(dfocus.curNode).replace("-", "")); |
| 43 |
}), 500); |
| 44 |
|
| 45 |
// go to second legend |
| 46 |
robot.keyPress(keys.TAB, 500, {}); |
| 47 |
robot.keyPress(keys.TAB, 500, {}); |
| 48 |
robot.keyPress(keys.TAB, 500, {}); |
| 49 |
robot.sequence(d.getTestErrback(function(){ |
| 50 |
doh.is("Fieldset 2", helpers.innerText(dfocus.curNode).replace("-", "")); |
| 51 |
}), 500); |
| 52 |
|
| 53 |
// go to last input |
| 54 |
robot.keyPress(keys.TAB, 500, {}); |
| 55 |
robot.keyPress(keys.TAB, 500, {}); |
| 56 |
robot.keyPress(keys.TAB, 500, {}); |
| 57 |
robot.sequence(d.getTestErrback(function(){ |
| 58 |
doh.is("last", dfocus.curNode.id); |
| 59 |
}), 500); |
| 60 |
|
| 61 |
// go to second legend |
| 62 |
robot.keyPress(keys.TAB, 500, {shift: true}); |
| 63 |
robot.keyPress(keys.TAB, 500, {shift: true}); |
| 64 |
robot.keyPress(keys.TAB, 500, {shift: true}); |
| 65 |
robot.sequence(d.getTestErrback(function(){ |
| 66 |
doh.is("Fieldset 2", helpers.innerText(dfocus.curNode).replace("-", "")); |
| 67 |
}), 500); |
| 68 |
|
| 69 |
// go to first legend |
| 70 |
robot.keyPress(keys.TAB, 500, {shift: true}); |
| 71 |
robot.keyPress(keys.TAB, 500, {shift: true}); |
| 72 |
robot.keyPress(keys.TAB, 500, {shift: true}); |
| 73 |
robot.sequence(d.getTestErrback(function(){ |
| 74 |
doh.is("Fieldset 1", helpers.innerText(dfocus.curNode).replace("-", "")); |
| 75 |
}), 500); |
| 76 |
|
| 77 |
// go to first input |
| 78 |
robot.keyPress(keys.TAB, 500, {shift: true}); |
| 79 |
robot.sequence(d.getTestCallback(function(){ |
| 80 |
doh.is("first", dfocus.curNode.id) |
| 81 |
}), 500); |
| 82 |
|
| 83 |
return d; |
| 84 |
} |
| 85 |
} |
| 86 |
|
| 87 |
// TODO: add basic tests for open/close |
| 88 |
]); |
| 89 |
|
| 90 |
doh.run(); |
| 91 |
}); |
| 92 |
</script> |
| 93 |
</head> |
| 94 |
</html> |