| 1 | <!DOCTYPE HTML> |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta http-equiv="content-type" content="text/html; charset=utf-8"/> |
| 5 | <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no" /> |
| 6 | <meta name="apple-mobile-web-app-capable" content="yes" /> |
| 7 | <title>IconMenu Bidi Tests</title> |
| 8 | <script type="text/javascript" src="../../../deviceTheme.js"></script> |
| 9 | <script type="text/javascript" src="../../../../../dojo/dojo.js" data-dojo-config="async: true, parseOnLoad: true, has: {'dojo-bidi': true }"></script> |
| 10 | <script language="JavaScript" type="text/javascript"> |
| 11 | |
| 12 | require([ |
| 13 | "dojo/sniff", |
| 14 | "dojo/dom-construct", // dojo.place |
| 15 | "dojo/ready", // dojo.ready |
| 16 | "dijit/registry", // dijit.byId |
| 17 | "doh/runner", //doh functions |
| 18 | "dojox/mobile/bidi/common", |
| 19 | "dojox/mobile", // This is a mobile app. |
| 20 | "dojox/mobile/View", // This mobile app uses mobile view |
| 21 | "dojox/mobile/compat", // This mobile app supports running on desktop browsers |
| 22 | "dojox/mobile/parser", // This mobile app uses declarative programming with fast mobile parser |
| 23 | "dojox/mobile/IconMenu" |
| 24 | |
| 25 | ], function(has, domConst, ready, registry, runner, common){ |
| 26 | |
| 27 | ready(function(){ |
| 28 | var lre = common.MARK.LRE; |
| 29 | var rle = common.MARK.RLE; |
| 30 | |
| 31 | function getFirstChar(item){ |
| 32 | var text = item.labelNode.innerHTML; |
| 33 | return text ? text.charAt(0) : ""; |
| 34 | }; |
| 35 | |
| 36 | runner.register("dojox.mobile.test.bidi.doh.IconMenuTests", [ |
| 37 | |
| 38 | function test_LTR_TextDir(){ |
| 39 | var item = registry.byId("item11"); |
| 40 | runner.assertEqual(lre, getFirstChar(item)); |
| 41 | item = registry.byId("item12"); |
| 42 | runner.assertEqual(lre, getFirstChar(item)); |
| 43 | item = registry.byId("item24"); |
| 44 | runner.assertEqual(lre, getFirstChar(item)); |
| 45 | }, |
| 46 | |
| 47 | function test_RTL_TextDir(){ |
| 48 | var item = registry.byId("item21"); |
| 49 | runner.assertEqual(rle, getFirstChar(item)); |
| 50 | item = registry.byId("item22"); |
| 51 | runner.assertEqual(rle, getFirstChar(item)); |
| 52 | item = registry.byId("item14"); |
| 53 | runner.assertEqual(rle, getFirstChar(item)); |
| 54 | }, |
| 55 | |
| 56 | function test_auto_TextDir(){ |
| 57 | var item = registry.byId("item31"); |
| 58 | runner.assertEqual(rle, getFirstChar(item)); |
| 59 | item = registry.byId("item32"); |
| 60 | runner.assertEqual(lre, getFirstChar(item)); |
| 61 | }, |
| 62 | |
| 63 | function test_change_Label(){ |
| 64 | var item = registry.byId("item34"); |
| 65 | item.set("label", "New label..."); |
| 66 | runner.assertEqual("auto", item.get("textDir")); |
| 67 | runner.assertEqual(lre, getFirstChar(item)); |
| 68 | } |
| 69 | ]); |
| 70 | runner.run(); |
| 71 | }); |
| 72 | }) |
| 73 | </script> |
| 74 | </head> |
| 75 | <body> |
| 76 | TextDir LTR |
| 77 | <ul data-dojo-type="dojox.mobile.IconMenu" style="width:274px;height:210px;margin:20px;" data-dojo-props='cols:2, textDir:"ltr"'> |
| 78 | <li data-dojo-type="dojox.mobile.IconMenuItem" id="item11" data-dojo-props='label:"\u05e9\u05dc\u05d5\u05dd dojo!", icon:"images/tab-icon-36w.png", selected:true'></li> |
| 79 | <li data-dojo-type="dojox.mobile.IconMenuItem" id="item12" data-dojo-props='label:"Hello dojo!", icon:"images/tab-icon-32w.png"'></li> |
| 80 | <li data-dojo-type="dojox.mobile.IconMenuItem" id="item13" data-dojo-props='label:"speaker", icon:"images/tab-icon-30w.png", selected:true'></li> |
| 81 | <li data-dojo-type="dojox.mobile.IconMenuItem" id="item14" data-dojo-props='label:"I am RTL!", icon:"images/tab-icon-16w.png", textDir:"rtl"'></li> |
| 82 | </ul> |
| 83 | TextDir RTL |
| 84 | <ul data-dojo-type="dojox.mobile.IconMenu" style="width:274px;height:210px;margin:20px;" data-dojo-props='cols:2, textDir:"rtl"'> |
| 85 | <li data-dojo-type="dojox.mobile.IconMenuItem" id="item21" data-dojo-props='label:"\u05e9\u05dc\u05d5\u05dd dojo!", icon:"images/tab-icon-36w.png", selected:true, textDir:"rtl"'></li> |
| 86 | <li data-dojo-type="dojox.mobile.IconMenuItem" id="item22" data-dojo-props='label:"Hello dojo!", icon:"images/tab-icon-32w.png"'></li> |
| 87 | <li data-dojo-type="dojox.mobile.IconMenuItem" id="item23" data-dojo-props='label:"speaker", icon:"images/tab-icon-30w.png", selected:true'></li> |
| 88 | <li data-dojo-type="dojox.mobile.IconMenuItem" id="item24" data-dojo-props='label:"I am LTR!", icon:"images/tab-icon-16w.png", textDir:"ltr"'></li> |
| 89 | </ul> |
| 90 | TextDir AUTO |
| 91 | <ul data-dojo-type="dojox.mobile.IconMenu" style="width:274px;height:210px;margin:20px;" data-dojo-props='cols:2, textDir:"auto"'> |
| 92 | <li data-dojo-type="dojox.mobile.IconMenuItem" id="item31" data-dojo-props='label:"\u05e9\u05dc\u05d5\u05dd dojo!", icon:"images/tab-icon-36w.png", selected:true'></li> |
| 93 | <li data-dojo-type="dojox.mobile.IconMenuItem" id="item32" data-dojo-props='label:"Hello dojo!", icon:"images/tab-icon-32w.png"'></li> |
| 94 | <li data-dojo-type="dojox.mobile.IconMenuItem" id="item33" data-dojo-props='label:"speaker", icon:"images/tab-icon-30w.png", selected:true'></li> |
| 95 | <li data-dojo-type="dojox.mobile.IconMenuItem" id="item34" data-dojo-props='label:"\u05e9\u05dc\u05d5\u05dd!", icon:"images/tab-icon-16w.png"'></li> |
| 96 | </ul> |
| 97 | </body> |
| 98 | </html> |