UNPKG

dijit

Version:

Dijit provides a complete collection of user interface controls based on Dojo, giving you the power to create web applications that are highly optimized for usability, performance, internationalization, accessibility, but above all deliver an incredible u

112 lines (89 loc) 2.75 kB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>robot ConfirmDialog A11Y Test</title> <style> <style> @import "../../../util/doh/robot/robot.css"; </style> <!-- required: dojo.js --> <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug: true"></script> <script type="text/javascript"> require([ "doh/runner", "dojo/robotx", "dojo/dom", "dojo/keys", "dijit/tests/helpers", "dojo/domReady!" ], function(doh, robot, dom, keys, helpers){ robot.initRobot('../test_ConfirmDialog.html'); doh.register(function setup(){ dfocus = robot.window.require("dijit/focus"); }); doh.register("Form", [ { name: "OK", timeout: 10000, runTest: function(){ var d = new doh.Deferred(); // Open drop down dom.byId("loginButton").focus(); robot.keyPress(keys.SPACE, 1000, {}); // Enter some data robot.typeKeys("scott", 1000, 800); robot.keyPress(keys.TAB, 500, {}); robot.typeKeys("tiger", 1000, 800); // Submit robot.keyPress(keys.TAB, 500, {}); robot.keyPress(keys.SPACE, 500, {}); robot.sequence(d.getTestCallback(function(){ doh.t(helpers.isHidden("loginDlg"), "dialog hidden"); doh.is("scott/tiger", dom.byId("formData").value, "form data"); }), 500); return d; } }, { name: "cancel", timeout: 10000, runTest: function(){ var d = new doh.Deferred(); // Open drop down dom.byId("loginButton").focus(); robot.keyPress(keys.SPACE, 1000, {}); // Cancel robot.keyPress(keys.TAB, 500, {}); robot.keyPress(keys.TAB, 500, {}); robot.keyPress(keys.TAB, 500, {}); robot.keyPress(keys.SPACE, 500, {}); robot.sequence(d.getTestCallback(function(){ doh.t(helpers.isHidden("loginDlg"), "dialog hidden"); doh.is("", dom.byId("formData").value, "form data"); }), 500); return d; } }, { name: "tabbing loops around", timeout: 10000, runTest: function(){ var d = new doh.Deferred(); // Open drop down dom.byId("loginButton").focus(); robot.keyPress(keys.SPACE, 1000, {}); // focuses "name" robot.keyPress(keys.TAB, 500, {}); // to "password" robot.keyPress(keys.TAB, 500, {}); // to "OK" robot.keyPress(keys.TAB, 500, {}); // to "Cancel" robot.keyPress(keys.TAB, 500, {}); // to "name" robot.sequence(d.getTestCallback(function(){ doh.is("user", dfocus.curNode.name, "focus looped back to name field"); }), 500); return d; } } ]); doh.run(); }); </script> </head> </html>