You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
113 lines
4.7 KiB
113 lines
4.7 KiB
<!DOCTYPE HTML> |
|
<html> |
|
<head> |
|
<meta http-equiv="content-type" content="text/html; charset=utf-8"/> |
|
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no" /> |
|
<meta name="apple-mobile-web-app-capable" content="yes" /> |
|
<title>Button Bidi Tests</title> |
|
<script type="text/javascript" src="../../../deviceTheme.js"></script> |
|
<script type="text/javascript" src="../../../../../dojo/dojo.js" data-dojo-config="async: true, parseOnLoad: true, has: {'dojo-bidi': true }"></script> |
|
<script language="JavaScript" type="text/javascript"> |
|
|
|
require([ |
|
"dojo/sniff", |
|
"dojo/dom-construct", // dojo.place |
|
"dojo/ready", // dojo.ready |
|
"dijit/registry", // dijit.byId |
|
"doh/runner", //doh functions, |
|
"dojo/_base/window", |
|
"dojox/mobile/bidi/common", |
|
"dojox/mobile/Button", |
|
"dojox/mobile", // This is a mobile app. |
|
"dojox/mobile/View", // This mobile app uses mobile view |
|
"dojox/mobile/compat", // This mobile app supports running on desktop browsers |
|
"dojox/mobile/parser" // This mobile app uses declarative programming with fast mobile parser |
|
], function(has, domConst, ready, registry, runner, win, common, Button){ |
|
|
|
function _createButtonProgrammatically(){ |
|
var demoWidget = new Button({"class":"redButton", style:"width:180px", label:"Pragramm Button!", id:"btn1", textDir:"rtl"}); |
|
win.body().appendChild(demoWidget.domNode); |
|
win.body().appendChild(domConst.create("br")); |
|
return demoWidget; |
|
} |
|
ready(function(){ |
|
var lre = common.MARK.LRE; |
|
var rle = common.MARK.RLE; |
|
|
|
var button1 = _createButtonProgrammatically(); |
|
var button2 = registry.byId("btn2"); |
|
var button3 = registry.byId("btn3"); |
|
var button4 = registry.byId("btn4"); |
|
var button5 = registry.byId("btn5"); |
|
var button6 = registry.byId("btn6"); |
|
|
|
function getFirstChar(btn){ |
|
var text = btn.domNode.innerHTML; |
|
return text ? text.charAt(0) : ""; |
|
}; |
|
|
|
runner.register("dojox.mobile.test.bidi.doh.ButtonTests", [ |
|
|
|
function test_LTR_TextDir(){ |
|
runner.assertEqual("ltr", button3.get("textDir"), "button textDir should be ltr"); |
|
runner.assertEqual(lre, getFirstChar(button3), "first char should be lte"); |
|
}, |
|
|
|
function test_RTL_TextDir(){ |
|
runner.assertEqual( "rtl", button1.get("textDir"), "button textDir should be rtl"); |
|
runner.assertEqual(rle, getFirstChar(button1), "first char should be rle button1"); |
|
runner.assertEqual("rtl", button2.get("textDir"), "button textDir should be rtl"); |
|
runner.assertEqual(rle, getFirstChar(button2), "first char should be rle button2"); |
|
runner.assertEqual("rtl", button6.get("textDir"), "button textDir should be rtl"); |
|
runner.assertEqual(rle, getFirstChar(button6), "first char should be rle button6"); |
|
}, |
|
|
|
function test_auto_TextDir(){ |
|
runner.assertEqual("auto", button4.get("textDir"), "button textDir should be auto"); |
|
runner.assertEqual(rle, getFirstChar(button4), "first char should be rle button4"); |
|
}, |
|
|
|
function test_change_textDir(){ |
|
button1.set("textDir", "ltr"); |
|
runner.assertEqual("ltr", button1.get("textDir")); |
|
runner.assertEqual(lre, getFirstChar(button1)); |
|
button1.set("textDir", "rtl"); |
|
button2.set("textDir", "auto"); |
|
runner.assertEqual("auto", button2.get("textDir")); |
|
runner.assertEqual(rle, getFirstChar(button2)); |
|
button2.set("textDir", "rtl"); |
|
button3.set("textDir", "rtl"); |
|
runner.assertEqual("rtl", button3.get("textDir")); |
|
runner.assertEqual(rle, getFirstChar(button3)); |
|
button3.set("textDir", "ltr"); |
|
}, |
|
|
|
function test_change_Label(){ |
|
button4.set("label", "New label..."); |
|
runner.assertEqual("auto", button4.get("textDir")); |
|
runner.assertEqual(lre, getFirstChar(button4)); |
|
} |
|
]); |
|
runner.run(); |
|
}); |
|
}) |
|
</script> |
|
</head> |
|
<body> |
|
<h1 data-dojo-type="dojox.mobile.Heading">Button</h1> |
|
<button data-dojo-type="dojox.mobile.Button" id="btn2" class="mblBlueButton" data-dojo-props='textDir:"rtl"'>חדש blue RTL...</button> |
|
textDir RTL |
|
<hr> |
|
<button data-dojo-type="dojox.mobile.Button" id="btn3" data-dojo-props='textDir:"ltr"' class="mblRedButton">חדש red default LTR...</button> |
|
textDir LTR |
|
<hr> |
|
<button data-dojo-type="dojox.mobile.Button" id="btn4" textDir="auto" disabled>חדש AUTO ...</button> |
|
textDir AUTO |
|
<hr> |
|
<button data-dojo-type="dojox.mobile.Button" id="btn5" disabled>חדש ...</button> |
|
textDir not set |
|
<hr> |
|
<button data-dojo-type="dojox.mobile.Button" id="btn6" class="mblRedButton" data-dojo-props='label:"חדש -new !", textDir:"rtl"'></button> |
|
textDir RTL |
|
</body> |
|
</html>
|
|
|