| 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>Tree View example (FileStore)</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 | "dojo/on", |
| 20 | "dojo/data/ItemFileReadStore", |
| 21 | "dijit/tree/ForestStoreModel", |
| 22 | "dojox/mobile/ListItem", |
| 23 | "dojox/mobile/parser", |
| 24 | "dojox/mobile", |
| 25 | "dojox/mobile/compat", |
| 26 | "dojox/mobile/TreeView", |
| 27 | "dojox/mobile/EdgeToEdgeDataList" |
| 28 | ], function(registry,runner,dom,ready,query,on,ItemFileReadStore, ForestStoreModel,ListItem){ |
| 29 | var store = new ItemFileReadStore({ |
| 30 | data: { |
| 31 | identifier: 'id', |
| 32 | label: 'name', |
| 33 | items: [{id:"1",name:"First!",type:"",undefined: "שלום First Item!"},{id:"2",name:"שלום Second!",type:"",undefined: "Second Item!"}] |
| 34 | } |
| 35 | }); |
| 36 | |
| 37 | treeModel = new ForestStoreModel({ |
| 38 | store: store, |
| 39 | rootLabel: "שלום Tree Items!", |
| 40 | childrenAttrs: ["children"], |
| 41 | query:{type:'*'} |
| 42 | }); |
| 43 | |
| 44 | ready(function(){ |
| 45 | runner.register("Bidi TreeView", [ |
| 46 | { |
| 47 | name: "mobile", |
| 48 | runTest: function(){ |
| 49 | var label = "Left-to-right ListItem!"; |
| 50 | listItem = new ListItem({label: label,noArrow: true}); |
| 51 | registry.byId("list").addChild(listItem); |
| 52 | var listItemLabels = query(".mblListItemLabel",dom.byId('list')); |
| 53 | runner.is(label.charAt(0),listItemLabels[0].innerHTML.charAt(0), "ListItem's label has default direction and shouldn't contain UCC marks"); |
| 54 | listItem.destroy(); |
| 55 | |
| 56 | var treeView = registry.byId('treeView'); |
| 57 | var children = treeView.getChildren(); |
| 58 | if(children[0] && children[0].getChildren() && children[0].getChildren()[0].declaredClass === "dojox.mobile.ListItem"){ |
| 59 | children[0].getChildren()[0].on("click", function(){ |
| 60 | query(".mblListItemLabel").forEach(function(node, index, arr){ |
| 61 | runner.is(String.fromCharCode(8235), node.innerHTML.charAt(0), "ListItem's label node should have direction correspondent to 'textDir'"); |
| 62 | }); |
| 63 | }); |
| 64 | } |
| 65 | |
| 66 | query(".mblListItemLabel",dom.byId('treeView')).forEach(function(node, index, arr){ |
| 67 | runner.is(String.fromCharCode(8235), node.innerHTML.charAt(0), "ListItem's label node should have direction correspondent to 'textDir'"); |
| 68 | }); |
| 69 | } |
| 70 | } |
| 71 | ]); |
| 72 | |
| 73 | runner.register("log", function(){ |
| 74 | dom.byId('failures').innerHTML = runner._failureCount; |
| 75 | dom.byId('errors').innerHTML = runner._errorCount; |
| 76 | }); |
| 77 | runner.run(); |
| 78 | }); |
| 79 | }); |
| 80 | </script> |
| 81 | </head> |
| 82 | <body style="visibility:hidden;"> |
| 83 | |
| 84 | <ul data-dojo-type="dojox.mobile.EdgeToEdgeDataList" id="list" data-dojo-props='append:true'></ul> |
| 85 | |
| 86 | <div id="treeView" data-dojo-type="dojox.mobile.TreeView" data-dojo-props='textDir:"rtl", model: treeModel'></div> |
| 87 | |
| 88 | <br>Errors: <span id="errors">?</span> |
| 89 | <br>Failures: <span id="failures">?</span> |
| 90 | </body> |
| 91 | </html> |