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
86 lines (71 loc) • 2.38 kB
HTML
<html>
<head>
<title>doh.robot ToggleDir Test</title>
<style>
@import "../../../../util/doh/robot/robot.css";
</style>
<script type="text/javascript" src="../../../../dojo/dojo.js"></script>
<script type="text/javascript">
require([
"doh/runner", "dojo/robotx",
"dojo/_base/array", "dojo/query", "dojo/window",
"dijit/tests/helpers", "dojo/domReady!"
], function(doh, robot, array, query, winUtils, helpers){
robot.initRobot('../test_ToggleDir.html');
var metaKey = {ctrl: true};
var registry;
doh.register("setup", [
{
name: "wait for editors to load",
timeout: 5000,
runTest: helpers.waitForLoad
},
function setVars(){
registry = robot.window.require("dijit/registry");
}
]);
array.forEach(["ltr", "rtl"], function(dir){
doh.register("testToggleDir " + dir, [
{
name: "toggleDir_toggleOn",
timeout: 6000,
runTest: function(){
var d = new doh.Deferred();
var editor = registry.byId(dir + "_ed");
robot.mouseMoveAt(query(".dijitEditorIconToggleDir", editor.domNode)[0], 1000);
robot.mouseClick({left: true}, 500);
robot.sequence(d.getTestCallback(function(){
var editDoc = editor.editorObject.contentWindow.document.documentElement;
editDoc = editDoc.getElementsByTagName("body")[0].firstChild;
doh.is(dir == "ltr" ? "rtl" : "ltr", editDoc.dir);
}), 500);
return d;
}
},
{
name: "toggleDir_toggleOff",
timeout: 6000,
runTest: function(){
var d = new doh.Deferred();
var editor = registry.byId(dir + "_ed");
robot.mouseMoveAt(query(".dijitEditorIconToggleDir", editor.domNode)[0], 1000);
robot.mouseClick({left: true}, 500);
robot.mouseMoveAt(dir + "_ed", 1000);
robot.mouseClick({left: true}, 500);
robot.sequence(d.getTestCallback(function(){
var editDoc = editor.editorObject.contentWindow.document.documentElement;
editDoc = editDoc.getElementsByTagName("body")[0].firstChild;
doh.is(dir, editDoc.dir);
}), 1000);
return d;
}
}
]);
});
doh.run();
});
</script>
</head>
</html>