This commit is contained in:
Éric Lemoine
2013-02-20 10:38:25 +01:00
parent 17c3936ab6
commit 5d14b9e2d4
1919 changed files with 559755 additions and 2588 deletions

View File

@@ -0,0 +1,414 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>doh.robot ComboBox textDir Tests</title>
<style>
@import "../../../../../util/doh/robot/robot.css";
</style>
<!-- required: dojo.js -->
<script type="text/javascript" src="../../../../../dojo/dojo.js">
</script>
<script type="text/javascript">
dojo.require("dijit.robotx");
dojo.ready(function(){
var combo;
doh.robot.initRobot('../test_SimpleComboBoxes.html');
doh.register("Test LTR combo box", [
{
name:"check drop down items text direction.",
timeout:3000,
setUp: function(){
combo = dijit.byId("fruitLtr");
modifier = dojo.isMac ? {meta: true} : {ctrl: true};
},
runTest:function(){
var d = new doh.Deferred();
// Open drop down
combo.focusNode.focus();
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 100);
doh.robot.sequence(d.getTestCallback(function(){
dojo.forEach(combo.dropDown.domNode.childNodes, function(node){
// so it will check only the options
if(node.item){
doh.is("ltr", node.dir, node.textContent);
}
});
}), 900);
return d;
},
tearDown: function(){
combo.closeDropDown();
}
},
{
name: "paste English in 'fruitLtr'",
timeout: 3000,
runTest: function(){
var d = new doh.Deferred();
doh.robot.keyPress("a", 300, modifier);
doh.robot.keyPress(dojo.keys.DELETE, 300, {});
doh.robot.typeKeys("Hi!!!", 1, 300);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("ltr",combo.focusNode.dir,"direction of :" + combo.id);
}), 300);
return d;
}
},
{
name: "paste Hebrew in 'fruitLtr'",
timeout: 3000,
runTest: function(){
var d = new doh.Deferred();
doh.robot.setClipboard("\u05e9\u05dc\u05d5\u05dd\u0021",'text/html');
doh.robot.keyPress("a", 300, modifier);
doh.robot.keyPress(dojo.keys.DELETE, 300, {});
doh.robot.keyPress("v", 300, modifier);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("ltr",combo.focusNode.dir,"direction of :" + combo.id);
}), 300);
return d;
}
}
]);
doh.register("Test RTL combo box", [
{
name:"check drop down items text direction.",
timeout:3000,
setUp: function(){
combo = dijit.byId("fruitRtl");
},
runTest:function(){
var d = new doh.Deferred();
// Open drop down
combo.focusNode.focus();
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 100);
doh.robot.sequence(d.getTestCallback(function(){
dojo.forEach(combo.dropDown.domNode.childNodes, function(node){
// so it will check only the options
if(node.item){
doh.is("rtl", node.dir, node.textContent);
}
});
}), 900);
return d;
},
tearDown: function(){
combo.closeDropDown();
}
},
{
name: "paste English in 'fruitRtl'",
timeout: 3000,
runTest: function(){
var d = new doh.Deferred();
doh.robot.keyPress("a", 300, modifier);
doh.robot.keyPress(dojo.keys.DELETE, 300, {});
doh.robot.typeKeys("Hi!!!", 1, 300);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("rtl",combo.focusNode.dir,"direction of :" + combo.id);
}), 300);
return d;
}
},
{
name: "paste Hebrew in 'fruitRtl'",
timeout: 3000,
runTest: function(){
var d = new doh.Deferred();
doh.robot.setClipboard("\u05e9\u05dc\u05d5\u05dd\u0021",'text/html');
doh.robot.keyPress("a", 300, modifier);
doh.robot.keyPress(dojo.keys.DELETE, 300, {});
doh.robot.keyPress("v", 300, modifier);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("rtl",combo.focusNode.dir,"direction of :" + combo.id);
}), 300);
return d;
}
}
]);
doh.register("Test AUTO ComboBox", [
{
name:"check drop down items text direction.",
timeout:60000,
setUp:function(){
combo = dijit.byId("fruitContextual");
modifier = dojo.isMac ? {meta: true} : {ctrl: true};
},
runTest:function(){
var d = new doh.Deferred();
var contextualDir;
// Create drop down
combo.focusNode.focus();
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 100);
doh.robot.sequence(d.getTestCallback(function(){
dojo.forEach(combo.dropDown.domNode.childNodes, function(node){
// so it will check only the options
if(node.item){
contextualDir = this.getTextDir(node.innerText || node.textContent || "");
doh.is(contextualDir, node.dir, node.innerText || node.textContent || "");
}
},combo);
}), 900);
return d;
},
tearDown: function(){
combo.closeDropDown();
}
},
{
name:"input field text direction for each item in the menu.",
timeout:6000,
setUp:function(){
combo = dijit.byId("fruitContextual");
modifier = dojo.isMac ? {meta: true} : {ctrl: true};
},
runTest:function(){
var d = new doh.Deferred();
combo.focusNode.focus();
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 100);
doh.robot.sequence(d.getTestErrback(function(){
doh.is("ltr",combo.focusNode.dir, combo.id);
}), 200);
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 300);
doh.robot.sequence(d.getTestErrback(function(){
doh.is("ltr",combo.focusNode.dir, combo.id);
}), 200);
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 200);
doh.robot.sequence(d.getTestErrback(function(){
doh.is("ltr",combo.focusNode.dir, combo.id);
}), 200);
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 200);
doh.robot.sequence(d.getTestErrback(function(){
doh.is("ltr",combo.focusNode.dir, combo.id);
}), 200);
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 200);
doh.robot.sequence(d.getTestErrback(function(){
doh.is("rtl",combo.focusNode.dir, combo.id);
}), 200);
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 200);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("rtl",combo.focusNode.dir, combo.id);
}), 200);
return d;
},
tearDown: function(){
combo.closeDropDown();
}
},
{
name: "text direction cut/paste English",
timeout: 3000,
runTest: function(){
var d = new doh.Deferred();
doh.robot.setClipboard("I am pasted!!!",'text/html');
doh.robot.keyPress("a", 500, modifier);
doh.robot.keyPress(dojo.keys.DELETE, 500, {});
doh.robot.keyPress("v", 500, modifier);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("ltr",combo.focusNode.dir,"direction of :" + combo.id);
}), 300);
return d;
}
},
{
name: "text direction cut/paste Hebrew before English",
timeout: 3000,
runTest: function(){
var d = new doh.Deferred();
doh.robot.setClipboard("\u05d0\u05e0\u05d9\u003a\u0020",'text/html');
dojo.isMac ? doh.robot.keyPress("a", 100, {ctrl:true}): doh.robot.keyPress(dojo.keys.HOME, 100, {});
doh.robot.keyPress("v", 400, modifier);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("rtl",combo.focusNode.dir,"direction of :" + combo.id);
}), 700);
return d;
}
}
]);
doh.register("Test AUTO ComboBox", [
{
name: "test auto-completion popup and input field for 'auto'",
timeout: 30000,
setUp: function(){
autoCompleted = dijit.byId("fruitContextualAC");
},
runTest: function(){
var d = new doh.Deferred();
autoCompleted.focusNode.focus();
// Filter drop down list to entries starting with ":"
doh.robot.sequence(function(){ autoCompleted.set("value", null); }, 400);
doh.robot.keyPress(":", 100);
doh.robot.sequence(d.getTestErrback(function(){
doh.is("ltr", autoCompleted.focusNode.dir, "input field of fruitContextualAC");
var entries = dojo.query("div", dojo.byId("fruitContextualAC_popup"));
doh.is("ltr", entries[1].dir, "list #1");
doh.is("rtl", entries[2].dir, "list #2");
}), 900);
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 200);
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 200);
doh.robot.sequence(d.getTestErrback(function(){
doh.is("rtl",autoCompleted.focusNode.dir, "input field of fruitContextualAC");
}), 200);
doh.robot.sequence(function(){ autoCompleted.set("value", null); }, 400);
doh.robot.keyPress("@", 100);
doh.robot.sequence(d.getTestErrback(function(){
doh.is("ltr", autoCompleted.focusNode.dir, "input field of fruitContextualAC");
var entries = dojo.query("div", dojo.byId("fruitContextualAC_popup"));
doh.is("ltr", entries[1].dir, "list #1");
}), 900);
doh.robot.sequence(function(){ autoCompleted.set("value", null); }, 400);
doh.robot.keyPress("*", 100);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("rtl", autoCompleted.focusNode.dir, "input field of fruitContextualAC");
var entries = dojo.query("div", dojo.byId("fruitContextualAC_popup"));
doh.is("rtl", entries[1].dir, "list #1");
}), 900);
return d;
}
},
{
name: "test auto-completion popup and input field for autoComplete:false",
timeout: 12000,
setUp: function(){
notAutoCompleted = dijit.byId("fruitContextual");
},
runTest: function(){
var d = new doh.Deferred();
notAutoCompleted.focusNode.focus();
// Filter drop down list to entries starting with ":"
doh.robot.sequence(function(){ notAutoCompleted.set("value", null); }, 400);
doh.robot.keyPress(":", 300);
doh.robot.sequence(d.getTestErrback(function(){
doh.is(notAutoCompleted.isLeftToRight() ? "ltr" : "rtl",
notAutoCompleted.focusNode.dir, "false autoComplete - :");
var entries = dojo.query("div", dojo.byId("fruitContextual_popup"));
doh.is("ltr", entries[1].dir, "list #1 - :");
doh.is("rtl", entries[2].dir, "list #2 - :");
}), 900);
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 200);
doh.robot.sequence(d.getTestErrback(function(){
doh.is("ltr",notAutoCompleted.focusNode.dir, "input field of fruitContextual - :");
}), 200);
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 200);
doh.robot.sequence(d.getTestErrback(function(){
doh.is("rtl",notAutoCompleted.focusNode.dir, "input field of fruitContextual - :");
}), 200);
// Filter drop down list to entries starting with "@"
doh.robot.sequence(function(){
notAutoCompleted.set("value", null);
}, 400);
doh.robot.keyPress("@", 100);
doh.robot.sequence(d.getTestErrback(function(){
doh.is(notAutoCompleted.isLeftToRight() ? "ltr" : "rtl",
notAutoCompleted.focusNode.dir, "false autoComplete - @");
var entries = dojo.query("div", dojo.byId("fruitContextual_popup"));
doh.is("ltr", entries[1].dir, "list #1 - @");
}), 900);
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 200);
doh.robot.sequence(d.getTestErrback(function(){
doh.is("ltr",notAutoCompleted.focusNode.dir, "input field of fruitContextual - :");
}), 200);
// Filter drop down list to entries starting with "*"
doh.robot.sequence(function(){ notAutoCompleted.set("value", null); }, 400);
doh.robot.keyPress("*", 100);
doh.robot.sequence(d.getTestErrback(function(){
doh.is(notAutoCompleted.isLeftToRight() ? "ltr" : "rtl",
notAutoCompleted.focusNode.dir, "false autoComplete - *");
var entries = dojo.query("div", dojo.byId("fruitContextual_popup"));
doh.is("rtl", entries[1].dir, "list #1 - *");
}), 900);
doh.robot.keyPress(dojo.keys.DOWN_ARROW, 200);
doh.robot.sequence(d.getTestCallback(function(){
doh.is("rtl",notAutoCompleted.focusNode.dir, "input field of fruitContextual - :");
}), 200);
return d;
}
}
]);
doh.run();
});
</script>
</head>
</html>