/[projects]/misc/horsensspejder-web/jquery/DataTables-1.9.4/media/unit_testing/tests_onhold/1_dom/aoColumns.bVisible2.js
ViewVC logotype

Contents of /misc/horsensspejder-web/jquery/DataTables-1.9.4/media/unit_testing/tests_onhold/1_dom/aoColumns.bVisible2.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2125 - (show annotations) (download) (as text)
Wed Mar 12 19:30:05 2014 UTC (10 years, 2 months ago) by torben
File MIME type: application/javascript
File size: 6507 byte(s)
initial import
1 // DATA_TEMPLATE: complex_header_2
2 oTest.fnStart( "aoColumns.bVisible with complex headers" );
3
4 $(document).ready( function () {
5 /* Check the default */
6 var oTable = $('#example').dataTable();
7 var oSettings = oTable.fnSettings();
8
9 oTest.fnTest(
10 "All columns are visible by default",
11 null,
12 function () { return $('#example tbody tr:eq(0) td').length == 5; }
13 );
14
15 oTest.fnTest(
16 "Hide the first column",
17 function () {
18 oSession.fnRestore();
19 $('#example').dataTable( {
20 "aoColumns": [
21 { "bVisible": false },
22 null,
23 null,
24 null,
25 null
26 ]
27 } );
28 },
29 function () { return $('#example tbody tr:eq(0) td').length == 4; }
30 );
31
32 oTest.fnTest(
33 "First cell is '2' - first column hidden",
34 null,
35 function () { return $('#example thead tr:eq(0) th:eq(0)').html() == "2"; }
36 );
37
38 oTest.fnTest(
39 "First cell has colspan of 3",
40 null,
41 function () { return $('#example thead tr:eq(0) th:eq(0)')[0].getAttribute('colspan') == 3; }
42 );
43
44 oTest.fnTest(
45 "First cell has rowspan of 2",
46 null,
47 function () { return $('#example thead tr:eq(0) th:eq(0)')[0].getAttribute('rowspan') == 2; }
48 );
49
50 oTest.fnTest(
51 "First cell in last column is '11'",
52 null,
53 function () { return $('#example thead tr:eq(4) th:eq(0)').html() == 11; }
54 );
55
56 oTest.fnTest(
57 "First cell in last column has been truncated to one column",
58 null,
59 function () { return $('#example thead tr:eq(4) th:eq(0)')[0].getAttribute('colspan') == 1; }
60 );
61
62
63 oTest.fnTest(
64 "Hide the second column",
65 function () {
66 oSession.fnRestore();
67 $('#example').dataTable( {
68 "aoColumns": [
69 null,
70 { "bVisible": false },
71 null,
72 null,
73 null
74 ]
75 } );
76 },
77 function () { return $('#example tbody tr:eq(0) td').length == 4; }
78 );
79
80 oTest.fnTest(
81 "First cell is '1' - second column hidden",
82 null,
83 function () { return $('#example thead tr:eq(0) th:eq(0)').html() == "1"; }
84 );
85
86 oTest.fnTest(
87 "Second cell is '2' - second column hidden",
88 null,
89 function () { return $('#example thead tr:eq(0) th:eq(1)').html() == "2"; }
90 );
91
92 oTest.fnTest(
93 "First cell in fourth row is '10' (visibly the first) - second column hidden",
94 null,
95 function () { return $('#example thead tr:eq(3) th:eq(0)').html() == "10"; }
96 );
97
98 oTest.fnTest(
99 "First cell has colspan of 1",
100 null,
101 function () { return $('#example thead tr:eq(0) th:eq(0)')[0].getAttribute('colspan') == 1; }
102 );
103
104 oTest.fnTest(
105 "Second cell has colspan of 2",
106 null,
107 function () { return $('#example thead tr:eq(0) th:eq(1)')[0].getAttribute('colspan') == 2; }
108 );
109
110 oTest.fnTest(
111 "First cell has rowspan of 1",
112 null,
113 function () { return $('#example thead tr:eq(0) th:eq(0)')[0].getAttribute('rowspan') == 1; }
114 );
115
116 oTest.fnTest(
117 "Second cell has rowspan of 2",
118 null,
119 function () { return $('#example thead tr:eq(0) th:eq(1)')[0].getAttribute('rowspan') == 2; }
120 );
121
122 oTest.fnTest(
123 "First cell in last column is '11'",
124 null,
125 function () { return $('#example thead tr:eq(4) th:eq(0)').html() == 11; }
126 );
127
128 oTest.fnTest(
129 "First cell in last column has been truncated to one column",
130 null,
131 function () { return $('#example thead tr:eq(4) th:eq(0)')[0].getAttribute('colspan') == 1; }
132 );
133
134
135 oTest.fnTest(
136 "Hide the first two columns",
137 function () {
138 oSession.fnRestore();
139 $('#example').dataTable( {
140 "aoColumns": [
141 { "bVisible": false },
142 { "bVisible": false },
143 null,
144 null,
145 null
146 ]
147 } );
148 },
149 function () { return $('#example tbody tr:eq(0) td').length == 3; }
150 );
151
152 oTest.fnTest(
153 "First cell is '2' - first two columns hidden",
154 null,
155 function () { return $('#example thead tr:eq(0) th:eq(0)').html() == "2"; }
156 );
157
158 oTest.fnTest(
159 "Second cell is '3' - first two columns hidden",
160 null,
161 function () { return $('#example thead tr:eq(0) th:eq(1)').html() == "3"; }
162 );
163
164 oTest.fnTest(
165 "First cell in third row is '6' - first two columns hidden",
166 null,
167 function () { return $('#example thead tr:eq(2) th:eq(0)').html() == "6"; }
168 );
169
170 oTest.fnTest(
171 "First cell has colspan of 2",
172 null,
173 function () { return $('#example thead tr:eq(0) th:eq(0)')[0].getAttribute('colspan') == 2; }
174 );
175
176 oTest.fnTest(
177 "First cell has rowspan of 2",
178 null,
179 function () { return $('#example thead tr:eq(0) th:eq(0)')[0].getAttribute('rowspan') == 2; }
180 );
181
182 oTest.fnTest(
183 "Second cell has rowspan of 1",
184 null,
185 function () { return $('#example thead tr:eq(0) th:eq(1)')[0].getAttribute('rowspan') == 1; }
186 );
187
188 oTest.fnTest(
189 "First cell in last column is '12'",
190 null,
191 function () { return $('#example thead tr:eq(4) th:eq(0)').html() == 12; }
192 );
193
194
195 oTest.fnTest(
196 "Hide the third column",
197 function () {
198 oSession.fnRestore();
199 $('#example').dataTable( {
200 "aoColumns": [
201 null,
202 null,
203 { "bVisible": false },
204 null,
205 null
206 ]
207 } );
208 },
209 function () { return $('#example tbody tr:eq(0) td').length == 4; }
210 );
211
212 oTest.fnTest(
213 "First cell is '1' - third column hidden",
214 null,
215 function () { return $('#example thead tr:eq(0) th:eq(0)').html() == "1"; }
216 );
217
218 oTest.fnTest(
219 "Second cell is '2' - third column hidden",
220 null,
221 function () { return $('#example thead tr:eq(0) th:eq(1)').html() == "2"; }
222 );
223
224 oTest.fnTest(
225 "First cell (visible second) in third row is '6' - third column hidden",
226 null,
227 function () { return $('#example thead tr:eq(2) th:eq(0)').html() == "6"; }
228 );
229
230 oTest.fnTest(
231 "Second cell has colspan of 2",
232 null,
233 function () { return $('#example thead tr:eq(0) th:eq(1)')[0].getAttribute('colspan') == 2; }
234 );
235
236 oTest.fnTest(
237 "Second cell has rowspan of 2",
238 null,
239 function () { return $('#example thead tr:eq(0) th:eq(1)')[0].getAttribute('rowspan') == 2; }
240 );
241
242 oTest.fnTest(
243 "Third row first cell (second visible) colspan is 1",
244 null,
245 function () { return $('#example thead tr:eq(2) th:eq(0)')[0].getAttribute('colspan') == 1; }
246 );
247
248 oTest.fnTest(
249 "Third row second cell (third visible) value is 7",
250 null,
251 function () { return $('#example thead tr:eq(2) th:eq(1)').html() == "7"; }
252 );
253
254 oTest.fnTest(
255 "Third row second cell (third visible) colspan is 1",
256 null,
257 function () { return $('#example thead tr:eq(2) th:eq(1)')[0].getAttribute('colspan') == 1; }
258 );
259
260 oTest.fnTest(
261 "Third row second cell (third visible) rowspan is 3",
262 null,
263 function () { return $('#example thead tr:eq(2) th:eq(1)')[0].getAttribute('rowspan') == 3; }
264 );
265
266
267 oTest.fnComplete();
268 } );

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20