Debian Codegraph @

dojox/mobile/tests/doh/HTML5-attribute-compliance.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"
6 content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
7 <meta name="apple-mobile-web-app-capable" content="yes"/>
8 <title>HTML5 Attribute Compliance</title>
9
10 <!-- DOH test for the changes introduced for HTML5 compliance
11 of attributes (#16188) -->
12
13 <script type="text/javascript" src="../../deviceTheme.js"></script>
14 <script type="text/javascript" src="../../../../dojo/dojo.js"
15 data-dojo-config="async: true, parseOnLoad: true"></script>
16
17 <script type="text/javascript">
18 require([
19 "dojo/dom",
20 "dojo/dom-class",
21 "dojo/ready",
22 "dijit/registry",
23 "doh/runner",
24 "dojox/mobile/parser",
25 "dojox/mobile",
26 "dojox/mobile/compat",
27 "dojox/mobile/ScrollableView",
28 "dojox/mobile/SwapView",
29 "dojox/mobile/Carousel",
30 "dojox/mobile/CarouselItem"
31 ], function(dom, domClass, ready, registry, runner){
32
33 ready(function(){
34 doh.register("dojox/mobile/test.doh.HTML5compliance", [
35 function testInView1(){
36 // Check support for "fixed" attribute on widgets
37 var view = registry.byId("view1");
38 var header = registry.byId("fixedTop1");
39 var footer = registry.byId("fixedBottom1");
40 runner.assertTrue(view.fixedHeader == header.domNode, "wrong header");
41 runner.assertTrue(view.fixedFooter == footer.domNode, "wrong footer");
42 },
43 function testInView2(){
44 // Check support for "fixed" attribute on HTML elements
45 var view = registry.byId("view2");
46 var header = dom.byId("fixedTop2");
47 var footer = dom.byId("fixedBottom2");
48 runner.assertTrue(view.fixedHeader == header, "wrong header");
49 runner.assertTrue(view.fixedFooter == footer, "wrong footer");
50 },
51 function testInView3(){
52 // Check support for "data-mobile-fixed" attribute on widgets (new in Dojo 1.9)
53 var view = registry.byId("view3");
54 var header = registry.byId("fixedTop3");
55 var footer = registry.byId("fixedBottom3");
56 runner.assertTrue(view.fixedHeader == header.domNode, "wrong header");
57 runner.assertTrue(view.fixedFooter == footer.domNode, "wrong footer");
58 },
59 function testInView4(){
60 // Check support for "data-mobile-fixed" attribute on HTML elements (new in Dojo 1.9)
61 var view = registry.byId("view4");
62 var header = dom.byId("fixedTop4");
63 var footer = dom.byId("fixedBottom4");
64 runner.assertTrue(view.fixedHeader == header, "wrong header");
65 runner.assertTrue(view.fixedFooter == footer, "wrong footer");
66 },
67 function testInView5(){
68 // Check support for "lazy":
69 // - as attribute (legacy), or
70 // - in data-dojo-props (new in Dojo 1.9);
71 var swapview = registry.byId("swapview1");
72 runner.assertTrue(!!swapview._instantiated,
73 "wrong instanciation of swapview1 (not lazy)");
74 swapview = registry.byId("swapview2");
75 runner.assertFalse(!!swapview._instantiated,
76 "wrong instanciation of swapview2 (lazy attribute)");
77 swapview = registry.byId("swapview3");
78 runner.assertFalse(!!swapview._instantiated,
79 "wrong instanciation of swapview3 (lazy in data-dojo-props)");
80 },
81 function testInView6(){
82 // Check support for "layout" / "data-mobile-layout" attributes
83 // on ListItem children:
84 // - "layout" (legacy), or
85 // - "data-mobile-layout" (new in Dojo 1.9);
86
87 var child = dom.byId("listItemChild1"); // left
88 runner.assertTrue(domClass.contains(child, "mblListItemLayoutLeft"), "layout - Left");
89 child = dom.byId("listItemChild2"); // center
90 runner.assertTrue(domClass.contains(child, "mblListItemLayoutCenter"), "layout - Center");
91 child = dom.byId("listItemChild3"); // center
92 runner.assertTrue(domClass.contains(child, "mblListItemLayoutRight"), "layout - Right");
93
94 child = dom.byId("listItemChild4"); // left
95 runner.assertTrue(domClass.contains(child, "mblListItemLayoutLeft"), "data-mobile-layout - Left");
96 child = dom.byId("listItemChild5"); // center
97 runner.assertTrue(domClass.contains(child, "mblListItemLayoutCenter"), "data-mobile-layout - Center");
98 child = dom.byId("listItemChild6"); // center
99 runner.assertTrue(domClass.contains(child, "mblListItemLayoutRight"), "data-mobile-layout - Right");
100 }
101 ]);
102 runner.run();
103 });
104 })
105 </script>
106
107 </head>
108 <body>
109 <!-- 1. "fixed" / "data-mobile-fixed" attribute for view header/footer -->
110
111 <!-- Using fixed as attribute (legacy) on widgets -->
112 <div id="view1" data-dojo-type="dojox/mobile/ScrollableView">
113 <!-- "fixed" attribute on widgets -->
114 <h1 id="fixedTop1" data-dojo-type="dojox/mobile/Heading"
115 fixed="top">Top 1</h1>
116 <h1 id="fixedBottom1" data-dojo-type="dojox/mobile/Heading"
117 fixed="bottom">Bottom 1</h1>
118 </div>
119
120 <!-- Using fixed as attribute (legacy) on HTML elements -->
121 <div id="view2" data-dojo-type="dojox/mobile/ScrollableView">
122 <!-- "fixed" attribute on HTML elements -->
123 <h1 id="fixedTop2" fixed="top">Top 2</h1>
124 <h1 id="fixedBottom2" fixed="bottom">Bottom 2</h1>
125 </div>
126
127 <!-- Using data-mobile-fixed as attribute (new in Dojo 1.9) on widgets -->
128 <div id="view3" data-dojo-type="dojox/mobile/ScrollableView">
129 <!-- "data-mobilefixed" attribute on widgets -->
130 <h1 id="fixedTop3" data-dojo-type="dojox/mobile/Heading"
131 data-mobile-fixed="top">Top 1</h1>
132 <h1 id="fixedBottom3" data-dojo-type="dojox/mobile/Heading"
133 data-mobile-fixed="bottom">Bottom 1</h1>
134 </div>
135
136 <!-- Using data-mobile fixed as attribute (new in Dojo 1.9) on HTML elements -->
137 <div id="view4" data-dojo-type="dojox/mobile/ScrollableView">
138 <!-- "data-mobile-fixed" attribute on HTML elements -->
139 <h1 id="fixedTop4" data-mobile-fixed="top">Top 2</h1>
140 <h1 id="fixedBottom4" data-mobile-fixed="bottom">Bottom 2</h1>
141 </div>
142
143 <!-- 2. "lazy" / "data-mobile-lazy" attribute for Carusel's children -->
144
145 <div id="view5" data-dojo-type="dojox/mobile/View">
146 <div id="carousel1" data-dojo-type="dojox/mobile/Carousel"
147 data-dojo-props='height:"150px", navButton:true, numVisible:2, title:"Category"'>
148
149 <div id="swapview1" data-dojo-type="dojox/mobile/SwapView">
150 <div data-dojo-type="dojox/mobile/CarouselItem"
151 data-dojo-props='src:"../images/dish1.jpg", value:"dish1", headerText:"dish1"'></div>
152 <div data-dojo-type="dojox/mobile/CarouselItem"
153 data-dojo-props='src:"../images/dish2.jpg", value:"dish2", headerText:"dish2"'></div>
154 </div>
155
156 <!-- Using lazy as attribute (legacy) -->
157 <div id="swapview2" data-dojo-type="dojox/mobile/SwapView" lazy="true">
158 <div data-dojo-type="dojox/mobile/CarouselItem"
159 data-dojo-props='src:"../images/dish3.jpg", value:"dish3", headerText:"dish3"'></div>
160 <div data-dojo-type="dojox/mobile/CarouselItem"
161 data-dojo-props='src:"../images/dish4.jpg", value:"dish4", headerText:"dish4"'></div>
162 </div>
163
164 <!-- Using lazy in data-dojo-props (new in Dojo 1.9) -->
165 <div id="swapview3" data-dojo-type="dojox/mobile/SwapView" data-dojo-props="lazy:'true'">
166 <div data-dojo-type="dojox/mobile/CarouselItem"
167 data-dojo-props='src:"../images/dish5.jpg", value:"dish5", headerText:"dish5"'></div>
168 <div data-dojo-type="dojox/mobile/CarouselItem"
169 data-dojo-props='src:"../images/dish6.jpg", value:"dish6", headerText:"dish6"'></div>
170 </div>
171 </div>
172 </div>
173
174 <div id="view6" data-dojo-type="dojox/mobile/View">
175 <ul data-dojo-type="dojox/mobile/RoundRectList">
176 <li data-dojo-type="dojox/mobile/ListItem">
177 <div id="listItemChild1" layout="left"><div>Left</div></div>
178 </li>
179 <li data-dojo-type="dojox/mobile/ListItem">
180 <div id="listItemChild2" layout="center">Center</div>
181 </li>
182 <li data-dojo-type="dojox/mobile/ListItem">
183 <div id="listItemChild3" layout="right">Right</div>
184 </li>
185 <li data-dojo-type="dojox/mobile/ListItem">
186 <div id="listItemChild4" data-mobile-layout="left">Left</div>
187 </li>
188 <li data-dojo-type="dojox/mobile/ListItem">
189 <div id="listItemChild5" data-mobile-layout="center">Center</div>
190 </li>
191 <li data-dojo-type="dojox/mobile/ListItem">
192 <div id="listItemChild6" data-mobile-layout="right">Right</div>
193 </li>
194 </ul>
195 </div>
196 </body>
197 </html>