Debian Codegraph @

dojox/mobile/tests/bidi/doh/test_EdgeToEdgeList.html

raw symbols SCIP
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>Edge to Edge</title>
8
9 <script type="text/javascript" src="../../../deviceTheme.js" data-dojo-config="mblThemeFiles: ['base']"></script>
10 <script type="text/javascript" src="../../../../../dojo/dojo.js" data-dojo-config="async: true,parseOnLoad: true, has: {'dojo-bidi': true }"></script>
11
12 <script type="text/javascript">
13 require([
14 "dijit/registry",
15 "doh/runner",
16 "dojo/dom",
17 "dojo/ready",
18 "dojo/query",
19 "dojox/mobile/ListItem",
20 "dojox/mobile/RoundRectCategory",
21 "dojox/mobile",
22 "dojox/mobile/compat",
23 "dojox/mobile/parser",
24 "dojox/mobile/Button"
25 ], function(registry,runner,dom,ready,query){
26 ready(function(){
27 runner.register("Bidi EdgeToEdgeList", [
28 {
29 name: "mobile",
30 runTest: function(){
31 var LRE = String.fromCharCode(8234);
32 var RLE = String.fromCharCode(8235);
33 var secondListItem = registry.byId('second');
34 var thirdListItem = registry.byId('third');
35
36 runner.is(RLE, secondListItem.rightTextNode.innerHTML.charAt(0), "right text node of second list item inherits textDir attribute from EdgeToEdgeList container");
37 runner.is(LRE, thirdListItem.rightTextNode.innerHTML.charAt(0), "direction of right text node of third list item has been set to 'ltr' explicitly");
38
39 var directionalMarksCount = 0;
40 query(" > *",dom.byId('second')).forEach(function(node, index, arr){
41 if(node.nodeName.toUpperCase() === "IMG" && node.nextSibling.nodeType === 3
42 && node.nextSibling.nodeValue === String.fromCharCode(8235)){
43 directionalMarksCount = 1;
44 } else if(node.className === "mblListItemRightIcon" && node.previousSibling.nodeType === 3
45 && directionalMarksCount === 1 && node.previousSibling.nodeValue === String.fromCharCode(8236)){
46 directionalMarksCount = 2;
47 }
48 });
49 runner.assertEqual(2,directionalMarksCount,"set of text containing nodes should be enclosed in directional marks");
50
51 thirdListItem.set("textDir","rtl");
52 var node = query(".mblListItemLabel",dom.byId('third'))[0];
53 runner.is(RLE, node.innerHTML.charAt(0), "label node had direction changed after change of 'textDir'");
54 }
55 }
56 ]);
57
58 runner.register("log", function(){
59 dom.byId('failures').innerHTML = runner._failureCount;
60 dom.byId('errors').innerHTML = runner._errorCount;
61 });
62
63 runner.run();
64 });
65 },
66 toggleTextDir = function(){
67 w2 = dijit.registry.byId("second");
68 w2.set("textDir", (w2.get("textDir") !== "rtl") ? "rtl" : "ltr");
69 });
70 </script>
71 </head>
72 <body style="visibility:hidden;">
73 <button data-dojo-type="dojox.mobile.Button" data-dojo-props='type:"button", onClick:function(){ toggleTextDir(); }'>Toggle textDir of second item</button>
74 <br>
75 <div id="settings" data-dojo-type="dojox/mobile/View">
76 <h2 data-dojo-type="dojox/mobile/RoundRectCategory" data-dojo-props='textDir:"rtl"'>RTL RoundRectCategory!</h2>
77 <ul data-dojo-type="dojox/mobile/EdgeToEdgeList" data-dojo-props='textDir:"rtl"'>
78 <li id="first" data-dojo-type="dojox/mobile/ListItem" data-dojo-props='icon:"../../images/i-icon-1.png"'>
79 <font style="font-style:italic; font-size: 16pt">Rtl </font>direction!!
80 <div data-dojo-type="dojox.mobile.Switch"></div>
81 </li>
82 <li id="second" data-dojo-type="dojox/mobile/ListItem" data-dojo-props='icon:"../../images/i-icon-2.png",rightText:"mac.", moveTo:"hello."'>
83 &nbsp;Wi-Fi!&nbsp;
84 &nbsp;<span>Internet!</span>&nbsp;
85 &nbsp;Speedy!&nbsp;
86 &nbsp;<font style="font-style:italic">Rtl direction!</font>&nbsp;
87 </li>
88 <li id="third" data-dojo-type="dojox/mobile/ListItem" data-dojo-props='icon:"../../images/i-icon-3.png",textDir:"ltr", rightText:"AcmePhone.", moveTo:"hello."'>
89 Rtl direction!
90 </li>
91 </ul>
92 </div>
93
94 <div id="hello" data-dojo-type="dojox/mobile/View">
95 <h1 data-dojo-type="dojox/mobile/Heading">Hello</h1>
96 <ul data-dojo-type="dojox/mobile/EdgeToEdgeList">
97 <li data-dojo-type="dojox/mobile/ListItem" data-dojo-props='moveTo:"settings"'>
98 Hello!
99 </li>
100 <li data-dojo-type="dojox/mobile/ListItem" data-dojo-props='moveTo:"settings"'>
101 Carrier!!
102 </li>
103 </ul>
104 </div>
105 <br>Errors:&nbsp;<span id="errors">?</span>
106 <br>Failures:&nbsp;<span id="failures">?</span>
107 </body>
108 </html>