Debian Codegraph @

dojox/grid/tests/bidi/test_styling.html

raw symbols SCIP
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
3 <html>
4 <head>
5 <title>RTL Grid Bidi Test</title>
6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
7 <style type="text/css">
8 @import "../../resources/Grid.css";
9 @import "../../resources/Grid_rtl.css";
10 body {
11 font-size: 0.9em;
12 font-family: Geneva, Arial, Helvetica, sans-serif;
13 }
14 .heading {
15 font-weight: bold;
16 padding-bottom: 0.25em;
17 }
18
19 #grid {
20 border: 1px solid #333;
21 width: 43em;
22 height: 30em;
23 }
24
25 #grid .dojoxGridRow {
26 border: none;
27 }
28
29 #grid .dojoxGridRowTable {
30 border-collapse: collapse;
31 }
32
33 #grid .dojoxGridCell {
34 border: 1px solid #333;
35 padding: 10px;
36 }
37
38 .selectedRow .dojoxGridCell {
39 background-color: #003366;
40 color: white;
41 }
42
43 .specialRow .dojoxGridCell {
44 background-color: dimgray;
45 }
46
47 .selectedRow.specialRow .dojoxGridCell {
48 text-decoration: line-through;
49 /* duplicate selection background-color so has precendence over specialRow background-color */
50 background-color: #003366;
51 }
52
53 /* in the yellow column, assign specific decoration for special rows that are selected */
54 .selectedRow.specialRow .yellowColumnData {
55 text-decoration: line-through underline;
56 }
57 .yellowColumn {
58 color: #006666;
59 }
60 .overRow .dojoxGridCell {
61 text-decoration: underline;
62 }
63 .greenColumn {
64 color: yellow;
65 background-color: #006666;
66 font-style: italic;
67 }
68 .yellowColumnData {
69 background-color: yellow;
70 text-decoration: underline;
71 }
72 .redColumnData {
73 color: blue;
74 background-color: pink;
75 text-decoration: underline;
76 }
77 </style>
78
79 <script type="text/javascript" src="../../../../dojo/dojo.js" data-dojo-config = "async: true, parseOnLoad: true, has: {'dojo-bidi': true}"></script>
80
81 <script type="text/javascript">
82 require([
83 "dojo/ready",
84 "dijit/registry",
85 "doh/runner",
86 "dojo/dom",
87 "dojo/query",
88 "dojo/data/ItemFileWriteStore",
89 "dojox/grid/DataGrid",
90 "dojo/parser",
91 "dojox/grid/cells/dijit"
92 ], function(ready, registry, runner, dom, query, ItemFileWriteStore){
93 ready(function(){
94 data = {identifier: 'id',label: 'id',items: []};
95 data_list = [
96 { col1: "Hello note!", col2: "Hello note!", col3: "Hello note!", col4: 'To problems of corruption by!', col5: 9.12, col6: "Hello note!"},
97 { col1: "\u05e9\u05dc\u05d5\u05dd note!", col2: "\u05e9\u05dc\u05d5\u05dd note!", col3: "\u05e9\u05dc\u05d5\u05dd note!", col4: 'Which would simply be awkward in!', col5: 12.15, col6: "\u05e9\u05dc\u05d5\u05dd!"}
98 ];
99 for(var i=0; i < 60; i++){
100 data.items.push(dojo.mixin({ id: i }, data_list[i%2]));
101 }
102 test_store = new ItemFileWriteStore({data: data});
103 var structure = [
104 {
105 noscroll: true,
106 cells: [
107 {name: 'Editable LTR!', editable: true, field: 'col1', textDir: 'ltr', width: 6, headerStyles: 'padding-bottom: 2px;', styles: 'border-bottom: 1px dashed #333; border-right: 1px dashed #333; padding: 6px;'},
108 {name: 'Editable RTL!', editable: true, field: 'col2', width: 6, headerStyles: 'padding-bottom: 2px;', styles: 'border-bottom: 1px dashed #333; border-right: 1px dashed #333; padding: 6px;'}
109 ]
110 },
111 [
112 {name: 'Editable Auto!', editable: true, field: 'col3', cellClasses: 'redColumnData', textDir: 'auto'},
113 {name: 'Editable inherit!', editable: true, field: 'col4', headerStyles: 'background-image: none; background-color: #003333;', classes: 'greenColumn'},
114 {name: 'Read-only Align center!', field: 'col5', cellClasses: 'yellowColumnData', classes: 'yellowColumn', styles: 'text-align: center;' },
115 {name: 'RTL Select!', cellType: dojox.grid.cells.Select, editable: true, field: 'col6', options: ["Hello note!", "\u05e9\u05dc\u05d5\u05dd note!"]}
116 ]
117 ];
118 var grid = dijit.registry.byId("grid");
119 grid.setStore(test_store);
120 grid.set('structure', structure);
121
122 runner.register("grid.tests.bidi.test_styling", [
123 {
124 name: "Grid styles, Bidi",
125 runTest: function(){
126 query(" .dojoxGridCell").forEach(function(node, index, arr){
127 switch(node.getAttribute("idx")){
128 case "0":
129 runner.is("ltr", node.style.direction, "cell node should have 'direction' style corresponding to 'textDir'");
130 break;
131 case "1":
132 case "3":
133 case "4":
134 case "5":
135 runner.is("rtl", node.style.direction, "cell node should have 'direction' style corresponding to 'textDir'");
136 }
137 });
138 }
139 }
140 ]);
141 runner.register("log", function(){
142 dom.byId('failures').innerHTML = runner._failureCount;
143 dom.byId('errors').innerHTML = runner._errorCount;
144 });
145 runner.run();
146 });
147
148 },
149 toggleGridTextDir = function(){
150 var grid = dijit.registry.byId("grid");
151 grid.set("textDir", (grid.get("textDir") === "rtl") ? "ltr" : "rtl");
152 } );
153 </script>
154 </head>
155 <body dir="rtl">
156 <input id="btn" type="button" onclick="toggleGridTextDir()" value="Toggle Grid TextDir"><br>
157 <br />
158 <div class="heading">RTL Grid Bidi Test</div>
159 <div id="grid" data-dojo-id="grid" data-dojo-type="dojox/grid/DataGrid" data-dojo-props='textDir: "rtl" '></div>
160
161 <br>Errors:&nbsp;<span id="errors">?</span>
162 <br>Failures:&nbsp;<span id="failures">?</span>
163 </body>
164 </html>