/public/javascripts/dojo-1.7.0/dijit/tests/_BidiSupport/form/robot/SimpleTextarea.html
https://github.com/zerekw/Kickpunch · HTML · 388 lines · 302 code · 85 blank · 1 comment · 0 complexity · a767787b715aa5a0bc60e6a0ce0709f2 MD5 · raw file
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <title>doh.robot SimpleTextarea 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(){
- doh.robot.initRobot('../test_SimpleTextarea.html');
- var textarea;
-
- var focusThenRun = function(widget, fcn){
- if(!widget.focused){
- var handler = widget.connect(widget, '_onFocus', function(){
- widget.disconnect(handler);
- setTimeout(fcn, 1);
- });
- widget.focus();
- }else{
- fcn();
- }
- };
- doh.register("LTR textarea", [
- {
- name: "initial text direction of filled 'ltrSimpleTexarea'",
-
- setUp: function(){
- textarea = dijit.byId("ltrSimpleTexarea");
- modifier = dojo.isMac ? {meta: true} : {ctrl: true};
- },
- runTest: function(){
- doh.is("ltr",textarea.focusNode.dir,"direction of :" + textarea.id);
- }
- },
- {
- name: "write in English in 'ltrSimpleTexarea'",
- timeout: 2000,
-
- runTest: function(){
- var d = new doh.Deferred();
- focusThenRun(textarea, function(){
- doh.robot.keyPress("a", 400, modifier);
- doh.robot.keyPress(dojo.keys.DELETE, 100, {});
- doh.robot.typeKeys("Hi this is my new value, and it's on English!!!", 1, 300);
-
- doh.robot.sequence(d.getTestCallback(function(){
- doh.is("ltr",textarea.focusNode.dir,"direction of :" + textarea.id);
- }), 800);
- });
-
- return d;
- }
- },
- {
- name: "paste Hebrew in 'ltrSimpleTexarea'",
- timeout: 2000,
- setUp: function(){
- textarea = dijit.byId("ltrSimpleTexarea");
- },
- runTest: function(){
- var d = new doh.Deferred();
-
- focusThenRun(textarea, function(){
- doh.robot.setClipboard("\u05d5\u05e2\u05db\u05e9\u05d9\u05d5\u0020\u05e7\u05e6\u05ea\u0020\u05d8\u05e7\u05e1\u05d8\u0020\u05d1\u05e2\u05d9\u05d1\u05e8\u05d9\u05ea\u0021\u0021\u0021\u000a\u05d0\u05e4\u05d9\u05dc\u05d5\u0020\u05e0\u05db\u05ea\u05d5\u05d1\u0020\u05e9\u05d5\u05e8\u05d4\u0020\u05e9\u05e0\u05d9\u05d9\u05d4\u002e\u0020\u0020\u0020",'text/html');
- doh.robot.keyPress("a", 400, modifier);
- doh.robot.keyPress(dojo.keys.DELETE, 100, {});
- doh.robot.keyPress("v", 300, modifier);
- doh.robot.sequence(d.getTestCallback(function(){
- doh.is("ltr",textarea.focusNode.dir,"direction of :" + textarea.id);
- }), 400);
- });
- return d;
- }
- }
- ]);
-
- doh.register("RTL textarea", [
- {
- name: "initial text direction of filled 'rtlSimpleTexarea'",
-
- setUp: function(){
- textarea = dijit.byId("rtlSimpleTexarea");
- },
- runTest: function(){
- doh.is("rtl",textarea.focusNode.dir,"direction of :" + textarea.id);
- }
- },
- {
- name: "write in English in 'rtlSimpleTexarea'",
- timeout: 2000,
-
- runTest: function(){
- var d = new doh.Deferred();
- focusThenRun(textarea, function(){
- doh.robot.keyPress("a", 400, modifier);
- doh.robot.keyPress(dojo.keys.DELETE, 100, {});
- doh.robot.typeKeys("Hi this is my new value, and it's on English!!!", 1, 300);
-
- doh.robot.sequence(d.getTestCallback(function(){
- doh.is("rtl",textarea.focusNode.dir,"direction of :" + textarea.id);
- }), 800);
- });
-
- return d;
- }
- },
- {
- name: "paste Hebrew in 'rtlSimpleTexarea'",
- timeout: 2000,
- runTest: function(){
- var d = new doh.Deferred();
- focusThenRun(textarea, function(){
- doh.robot.setClipboard("\u05d5\u05e2\u05db\u05e9\u05d9\u05d5\u0020\u05e7\u05e6\u05ea\u0020\u05d8\u05e7\u05e1\u05d8\u0020\u05d1\u05e2\u05d9\u05d1\u05e8\u05d9\u05ea\u0021\u0021\u0021\u000a\u05d0\u05e4\u05d9\u05dc\u05d5\u0020\u05e0\u05db\u05ea\u05d5\u05d1\u0020\u05e9\u05d5\u05e8\u05d4\u0020\u05e9\u05e0\u05d9\u05d9\u05d4\u002e\u0020\u0020\u0020",'text/html');
- doh.robot.keyPress("a", 400, modifier);
- doh.robot.keyPress(dojo.keys.DELETE, 100, {});
- doh.robot.keyPress("v", 300, modifier);
- doh.robot.sequence(d.getTestCallback(function(){
- doh.is("rtl",textarea.focusNode.dir,"direction of :" + textarea.id);
- }), 400);
- });
- return d;
- }
- }
- ]);
- doh.register("Contextual textarea", [
- {
- name: "initial text direction of filled 'contextualSimpleTexarea'",
-
- setUp: function(){
- textarea = dijit.byId("contextualSimpleTexarea");
- },
- runTest: function(){
- doh.is("rtl",textarea.focusNode.dir,"direction of :" + textarea.id);
- }
- },
- {
- name: "write in English in 'contextualSimpleTexarea'",
- timeout: 2000,
-
- runTest: function(){
- var d = new doh.Deferred();
-
- focusThenRun(textarea, function(){
- doh.robot.keyPress("a", 400, modifier);
- doh.robot.keyPress(dojo.keys.DELETE, 100, {});
- doh.robot.typeKeys("Hi this is my new value, and it's on English!!!", 1, 400);
-
- doh.robot.sequence(d.getTestCallback(function(){
- doh.is("ltr",textarea.focusNode.dir,"direction of :" + textarea.id);
- }), 500);
- });
-
- return d;
- }
- },
- {
- name: "text direction paste Hebrew before English",
- timeout: 3000,
- runTest: function(){
- var d = new doh.Deferred(),
- modifier = dojo.isMac ? {meta: true} : {ctrl: true},
- textarea = dijit.byId("contextualSimpleTexarea");
- focusThenRun(textarea, function(){
- doh.robot.setClipboard("\u05d0\u05e0\u05d9\u0020\u05d0\u05d5\u05de\u05e8\u05ea\u003a\u0020");
- 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",textarea.focusNode.dir,"direction of :" + textarea.id);
- }), 800);
- });
- return d;
- }
- }
- ]);
- doh.register("programmaticAuto textarea in the border container", [
- {
- name: "initial text direction of filled 'programmaticAuto'",
-
- setUp: function(){
- textarea = dijit.byId("programmaticAuto");
- modifier = dojo.isMac ? {meta: true} : {ctrl: true};
- },
- runTest: function(){
- doh.is("auto",textarea.textDir,"direction of :" + textarea.id);
- }
- },
- {
- name: "write in English in 'programmaticAuto'",
- timeout: 2000,
-
- runTest: function(){
- var d = new doh.Deferred();
- focusThenRun(textarea, function(){
- doh.robot.keyPress("a", 400, modifier);
- doh.robot.keyPress(dojo.keys.DELETE, 100, {});
- doh.robot.typeKeys("Hi this is my new value, and it's on English!!!", 1, 300);
-
- doh.robot.sequence(d.getTestCallback(function(){
- doh.is("ltr",textarea.focusNode.dir,"direction of :" + textarea.id);
- }), 800);
- });
-
- return d;
- }
- },
- {
- name: "paste Hebrew in 'programmaticAuto'",
- timeout: 2000,
- runTest: function(){
- var d = new doh.Deferred();
-
- focusThenRun(textarea, function(){
- doh.robot.setClipboard("\u05d5\u05e2\u05db\u05e9\u05d9\u05d5\u0020\u05e7\u05e6\u05ea\u0020\u05d8\u05e7\u05e1\u05d8\u0020\u05d1\u05e2\u05d9\u05d1\u05e8\u05d9\u05ea\u0021\u0021\u0021\u000a\u05d0\u05e4\u05d9\u05dc\u05d5\u0020\u05e0\u05db\u05ea\u05d5\u05d1\u0020\u05e9\u05d5\u05e8\u05d4\u0020\u05e9\u05e0\u05d9\u05d9\u05d4\u002e\u0020\u0020\u0020",'text/html');
- doh.robot.keyPress("a", 400, modifier);
- doh.robot.keyPress(dojo.keys.DELETE, 100, {});
- doh.robot.keyPress("v", 300, modifier);
- doh.robot.sequence(d.getTestCallback(function(){
- doh.is("rtl",textarea.focusNode.dir,"direction of :" + textarea.id);
- }), 400);
- });
- return d;
- }
- }
- ]);
-
- doh.register("programmaticRTL textarea in the border container", [
- {
- name: "initial text direction of filled 'programmaticRTL'",
-
- setUp: function(){
- textarea = dijit.byId("programmaticRTL");
- },
- runTest: function(){
- doh.is("rtl",textarea.focusNode.dir,"direction of :" + textarea.id);
- }
- },
- {
- name: "write in English in 'programmaticRTL'",
- timeout: 2000,
-
- runTest: function(){
- var d = new doh.Deferred();
- focusThenRun(textarea, function(){
- doh.robot.keyPress("a", 400, modifier);
- doh.robot.keyPress(dojo.keys.DELETE, 100, {});
- doh.robot.typeKeys("Hi this is my new value, and it's on English!!!", 1, 300);
-
- doh.robot.sequence(d.getTestCallback(function(){
- doh.is("rtl",textarea.focusNode.dir,"direction of :" + textarea.id);
- }), 800);
- });
-
- return d;
- }
- },
- {
- name: "paste Hebrew in 'programmaticRTL'",
- timeout: 2000,
- runTest: function(){
- var d = new doh.Deferred();
- focusThenRun(textarea, function(){
- doh.robot.setClipboard("\u05d5\u05e2\u05db\u05e9\u05d9\u05d5\u0020\u05e7\u05e6\u05ea\u0020\u05d8\u05e7\u05e1\u05d8\u0020\u05d1\u05e2\u05d9\u05d1\u05e8\u05d9\u05ea\u0021\u0021\u0021\u000a\u05d0\u05e4\u05d9\u05dc\u05d5\u0020\u05e0\u05db\u05ea\u05d5\u05d1\u0020\u05e9\u05d5\u05e8\u05d4\u0020\u05e9\u05e0\u05d9\u05d9\u05d4\u002e\u0020\u0020\u0020",'text/html');
- doh.robot.keyPress("a", 400, modifier);
- doh.robot.keyPress(dojo.keys.DELETE, 100, {});
- doh.robot.keyPress("v", 300, modifier);
- doh.robot.sequence(d.getTestCallback(function(){
- doh.is("rtl",textarea.focusNode.dir,"direction of :" + textarea.id);
- }), 400);
- });
- return d;
- }
- }
- ]);
- doh.register("programmaticLTR textarea in the border container", [
- {
- name: "initial text direction of filled 'programmaticLTR'",
-
- setUp: function(){
- textarea = dijit.byId("programmaticLTR");
- },
- runTest: function(){
- doh.is("ltr",textarea.focusNode.dir,"direction of :" + textarea.id);
- }
- },
- {
- name: "write in English in 'programmaticLTR'",
- timeout: 2000,
-
- runTest: function(){
- var d = new doh.Deferred();
-
- focusThenRun(textarea, function(){
- doh.robot.keyPress("a", 400, modifier);
- doh.robot.keyPress(dojo.keys.DELETE, 100, {});
- doh.robot.typeKeys("Hi this is my new value, and it's on English!!!", 1, 400);
-
- doh.robot.sequence(d.getTestCallback(function(){
- doh.is("ltr",textarea.focusNode.dir,"direction of :" + textarea.id);
- }), 500);
- });
-
- return d;
- }
- },
- {
- name: "text direction paste Hebrew before English",
- timeout: 3000,
- runTest: function(){
- var d = new doh.Deferred(),
- modifier = dojo.isMac ? {meta: true} : {ctrl: true};
- focusThenRun(textarea, function(){
- doh.robot.setClipboard("\u05d5\u05e2\u05db\u05e9\u05d9\u05d5\u0020\u05e7\u05e6\u05ea\u0020\u05d8\u05e7\u05e1\u05d8\u0020\u05d1\u05e2\u05d9\u05d1\u05e8\u05d9\u05ea\u0021\u0021\u0021\u000a\u05d0\u05e4\u05d9\u05dc\u05d5\u0020\u05e0\u05db\u05ea\u05d5\u05d1\u0020\u05e9\u05d5\u05e8\u05d4\u0020\u05e9\u05e0\u05d9\u05d9\u05d4\u002e\u0020\u0020\u0020",'text/html');
- doh.robot.keyPress("a", 400, modifier);
- doh.robot.keyPress(dojo.keys.DELETE, 100, {});
- doh.robot.keyPress("v", 400, modifier);
- doh.robot.sequence(d.getTestCallback(function(){
- doh.is("ltr",textarea.focusNode.dir,"direction of :" + textarea.id);
- }), 800);
-
- });
- return d;
- }
- }
- ]);
- doh.run();
- });
- </script>
- </head>
- </html>