comparison default/node_modules/tablesaw/test-qunit/tablesaw_test.js @ 0:1d038bc9b3d2 default tip

Up:default
author Liny <dev@neowd.com>
date Sat, 31 May 2025 09:21:51 +0800
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1d038bc9b3d2
1 (function($) {
2 /*
3 ======== A Handy Little QUnit Reference ========
4 http://api.qunitjs.com/
5
6 Test methods:
7 QUnit.module(name, {[setup][ ,teardown]})
8 QUnit.test(name, callback)
9 expect(numberOfAssertions)
10 stop(increment)
11 start(decrement)
12 Test assertions:
13 assert.ok(value, [message])
14 assert.equal(actual, expected, [message])
15 notEqual(actual, expected, [message])
16 deepEqual(actual, expected, [message])
17 notDeepEqual(actual, expected, [message])
18 strictEqual(actual, expected, [message])
19 notStrictEqual(actual, expected, [message])
20 throws(block, [expected], [message])
21 */
22
23 var tableHtml = [
24 '<table %s>',
25 '<thead>',
26 '<tr>',
27 '<th data-tablesaw-priority="1" data-tablesaw-sortable-col>Header</th>',
28 '<th data-tablesaw-sortable-col data-tablesaw-sortable-numeric>Header</th>',
29 '<th>Header</th>',
30 '<th>Header</th>',
31 '<th>Header</th>',
32 '<th>Header</th>',
33 '<th>Header</th>',
34 '<th>Header</th>',
35 '<th>Header</th>',
36 '<th>Header</th>',
37 '<th>Header</th>',
38 '<th>Header</th>',
39 '<th>Header</th>',
40 '<th>Header</th>',
41 '<th>Header</th>',
42 '<th>Header</th>',
43 '<th>Header</th>',
44 '<th>Header</th>',
45 '<th data-tablesaw-priority="6">Header</th>',
46 '</tr>',
47 '</thead>',
48 '<tbody>',
49 '<tr>',
50 '<td>Body Row 1</td>',
51 '<td>1</td>',
52 '<td>This column text is designed to make the columns really wide.</td>',
53 '<td>This column text is designed to make the columns really wide.</td>',
54 '<td>This column text is designed to make the columns really wide.</td>',
55 '<td>This column text is designed to make the columns really wide.</td>',
56 '<td>This column text is designed to make the columns really wide.</td>',
57 '<td>This column text is designed to make the columns really wide.</td>',
58 '<td>This column text is designed to make the columns really wide.</td>',
59 '<td>This column text is designed to make the columns really wide.</td>',
60 '<td>This column text is designed to make the columns really wide.</td>',
61 '<td>This column text is designed to make the columns really wide.</td>',
62 '<td>This column text is designed to make the columns really wide.</td>',
63 '<td>This column text is designed to make the columns really wide.</td>',
64 '<td>This column text is designed to make the columns really wide.</td>',
65 '<td>This column text is designed to make the columns really wide.</td>',
66 '<td>This column text is designed to make the columns really wide.</td>',
67 '<td>This column text is designed to make the columns really wide.</td>',
68 '<td>This column text is designed to make the columns really wide.</td>',
69 '</tr>',
70 '<tr><td>Body Row 2</td><td>2</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td></tr>',
71 '<tr><td>Body Row 10</td><td>10</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td></tr>',
72 '<tr><td>body row 4</td><td>10</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td></tr>',
73 '<tr><td>Body Row 1.2</td><td>1.2</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td><td>A</td></tr>',
74 '</tbody>',
75 '</table>'].join(''),
76 $fixture,
77 $table,
78 setup = function( tableAttributes ) {
79 return function() {
80 $fixture = $( '#qunit-fixture' );
81 // We use columntoggle here to make the cell html comparisons easier (stack adds elements to each cell)
82 $fixture.html( tableHtml.replace( /\%s/, tableAttributes ) );
83 $( document ).trigger( 'enhance.tablesaw' );
84
85 $table = $fixture.find( 'table' );
86 };
87 };
88
89 QUnit.module( 'Global' );
90 QUnit.test( 'Initialization', function( assert ) {
91 assert.ok( $( 'html' ).is( '.tablesaw-enhanced' ), 'Has initialization class.' );
92 });
93
94 QUnit.module( 'tablesaw is opt-in only, no default', {
95 beforeEach: setup( '' )
96 });
97
98 QUnit.test( 'Initialization', function( assert ) {
99 assert.ok( $table[ 0 ].className.indexOf( 'tablesaw-' ) === -1, 'Does not have initialization class.' );
100 });
101
102 QUnit.module( 'tablesaw Stack', {
103 beforeEach: setup( 'data-tablesaw-mode="stack"' )
104 });
105
106 QUnit.test( 'Initialization', function( assert ) {
107 assert.ok( $table.is( '.tablesaw-stack' ), 'Has initialization class.' );
108 });
109
110 QUnit.module( 'tablesaw Column Toggle', {
111 beforeEach: setup( 'data-tablesaw-mode="columntoggle"' )
112 });
113
114 QUnit.test( 'Initialization', function( assert ) {
115 assert.ok( $table.is( '.tablesaw-columntoggle' ), 'Has initialization class.' );
116 assert.ok( $jQ( $table.find( 'tbody td' )[ 0 ] ).is( ':visible' ), 'First cell is visible' );
117 });
118
119 QUnit.test( 'Show Dialog', function( assert ) {
120 assert.ok( !$jQ( $fixture.find( '.tablesaw-columntoggle-popup' )[ 0 ] ).is( ':visible' ), 'Dialog hidden' );
121
122 $table.prev().find( '.tablesaw-columntoggle-btn' ).trigger( "click" );
123
124 assert.ok( $jQ( $fixture.find( '.tablesaw-columntoggle-popup' )[ 0 ] ).is( ':visible' ), 'Dialog visible after button click' );
125 });
126
127 QUnit.test( 'Toggle Column', function( assert ) {
128 var $cell = $table.find( 'tbody td' ).eq( 0 );
129
130 assert.strictEqual( $cell.is( '.tablesaw-toggle-cellhidden' ), false, 'First cell is visible before checkbox unchecked' );
131
132 $table.prev().find( '.tablesaw-columntoggle-btn' ).trigger( 'click' )
133 .next().find( 'input[type="checkbox"]' ).trigger( 'click' );
134
135 // close dialog
136 $( '.tablesaw-columntoggle-popup .close' ).trigger( "click" );
137
138 assert.strictEqual( $cell.is( '.tablesaw-toggle-cellhidden' ), true, 'First cell is hidden after checkbox unchecked' );
139 });
140
141
142 QUnit.module( 'tablesaw Swipe', {
143 beforeEach: setup( 'data-tablesaw-mode="swipe"' )
144 });
145
146 QUnit.test( 'Initialization', function( assert ) {
147 var $buttons = $table.prev().find( '.tablesaw-nav-btn' );
148 assert.ok( $table.is( '.tablesaw-swipe' ), 'Has initialization class.' );
149 assert.equal( $buttons.length, 2, 'Has buttons.' );
150 });
151
152 QUnit.test( 'Navigate with buttons', function( assert ) {
153 var $buttons = $table.prev().find( '.tablesaw-nav-btn' ),
154 $prev = $buttons.filter( '.left' ),
155 $next = $buttons.filter( '.right' );
156
157 assert.ok( $prev.is( '.disabled' ), 'Starts at far left, previous button disabled.' );
158 assert.ok( !$next.is( '.disabled' ), 'Starts at far left, next button enabled.' );
159 assert.ok( $table.find( 'tbody td:first-child' ).not( '.tablesaw-swipe-cellhidden' ), 'First column is visible' );
160
161 $next.trigger( 'click' );
162 assert.ok( !$prev.is( '.disabled' ), 'Previous button enabled.' );
163 assert.ok( $table.find( 'tbody td:first-child' ).is( '.tablesaw-swipe-cellhidden' ), 'First column is hidden after click' );
164 });
165
166 QUnit.module( 'tablesaw Sortable without a Mode', {
167 beforeEach: setup( 'data-tablesaw-sortable' )
168 });
169
170 QUnit.test( 'Sortable still initializes without a data-tablesaw-mode', function( assert ) {
171 assert.ok( $table.is( '.tablesaw-sortable' ), 'Has initialization class.' );
172 assert.ok( $table.find( '.tablesaw-sortable-head' ).length > 0, 'Header has sort class.' );
173 });
174
175 QUnit.module( 'tablesaw Sortable', {
176 beforeEach: setup( 'data-tablesaw-mode="columntoggle" data-tablesaw-sortable' )
177 });
178
179 QUnit.test( 'Initialization', function( assert ) {
180 assert.ok( $table.is( '.tablesaw-sortable' ), 'Has initialization class.' );
181 assert.ok( $table.find( '.tablesaw-sortable-head' ).length > 0, 'Header has sort class.' );
182 });
183
184 QUnit.test( 'Can sort descending', function( assert ) {
185 var previousRow1Text = $table.find( 'tbody tr td' ).eq( 0 ).text(),
186 $sortButton = $table.find( '.tablesaw-sortable-head button' ).eq( 0 );
187
188 $sortButton.trigger( "click" );
189
190 assert.equal( $table.find( 'tbody tr td' ).eq( 0 ).text(), previousRow1Text, 'First row is sorted ascending' );
191
192 $sortButton.trigger( "click" );
193
194 assert.notEqual( $table.find( 'tbody tr td' ).eq( 0 ).text(), previousRow1Text, 'First row is sorted descending' );
195 });
196
197 QUnit.test( 'Can sort numeric descending', function( assert ) {
198 var $sortButton = $table.find( '.tablesaw-sortable-head button' ).eq( 1 );
199
200 $sortButton.trigger( "click" );
201
202 assert.equal( $table.find( "tbody tr" ).eq( 0 ).find( "td" ).eq( 1 ).html(), '1', 'First row is sorted ascending' );
203
204 $sortButton.trigger( "click" );
205
206 assert.equal( $table.find( "tbody tr" ).eq( 0 ).find( "td" ).eq( 1 ).html(), '10', 'First row is sorted descending' );
207 });
208
209 QUnit.test( 'Sort works with floats', function( assert ) {
210 var previousText = "Body Row 1.2",
211 $sortButton = $table.find( '.tablesaw-sortable-head button' ).eq( 0 ),
212 rows = $table.find( 'tbody tr' ).length;
213
214 $sortButton.trigger( "click" );
215 assert.equal( $table.find( "tbody tr" ).eq( 1 ).find( "td" ).eq( 0 ).text(), previousText, previousText + ' is in the second row (descending)' );
216
217 $sortButton.trigger( "click" );
218 assert.equal( $table.find( "tbody tr" ).eq( rows - 2 ).find( "td" ).eq( 0 ).text(), previousText, previousText + ' is in row ' + ( rows - 2 ) + ' of ' + rows + ' (ascending)' );
219
220 });
221
222 QUnit.test( 'Sort is case insensitive', function( assert ) {
223 var previousText = "body row 4",
224 $sortButton = $table.find( '.tablesaw-sortable-head button' ).eq( 0 );
225
226 $sortButton.trigger( "click" );
227 assert.equal( $table.find( "tbody tr" ).eq( 4 ).find( "td" ).eq( 0 ).text(), previousText, previousText + ' is in the fifth row (ascending)' );
228
229 $sortButton.trigger( "click" );
230 assert.equal( $table.find( "tbody tr" ).eq( 0 ).find( "td" ).eq( 0 ).text(), previousText, previousText + ' is in the first row (descending)' );
231
232 });
233
234 QUnit.module( 'tablesaw Sortable Switcher', {
235 beforeEach: setup( 'data-tablesaw-mode="columntoggle" data-tablesaw-sortable data-tablesaw-sortable-switch' )
236 });
237
238 QUnit.test( 'Can sort descending with switcher', function( assert ) {
239 var previousRow1Text = $table.find( 'tbody tr td' ).eq( 0 ).text(),
240 $switcher = $table.prev().find( 'select' ).eq( 0 );
241
242 $switcher.val( '0_desc' ).trigger( 'change' );
243
244 assert.notEqual( $table.find( 'tbody tr td' ).eq( 0 ).text(), previousRow1Text, 'First row is sorted descending' );
245
246 $switcher.val( '0_asc' ).trigger( 'change' );
247
248 assert.equal( $table.find( 'tbody tr td' ).eq( 0 ).text(), previousRow1Text, 'First row is sorted ascending' );
249 });
250
251 QUnit.test( 'Can sort numeric descending with switcher', function( assert ) {
252 var $switcher = $table.prev().find( 'select' ).eq( 0 );
253
254 $switcher.val( '1_desc' ).trigger( 'change' );
255
256 assert.equal( $table.find( "tbody tr" ).eq( 0 ).find( "td" ).eq( 1 ).html(), '10', 'First row is sorted descending' );
257
258 $switcher.val( '1_asc' ).trigger( 'change' );
259
260 assert.equal( $table.find( "tbody tr" ).eq( 0 ).find( "td" ).eq( 1 ).html(), '1', 'First row is sorted ascending' );
261 });
262
263 QUnit.module( 'tablesaw Mini Map', {
264 beforeEach: setup( 'data-tablesaw-mode="columntoggle" data-tablesaw-minimap' )
265 });
266
267 QUnit.test( 'Initialization', function( assert ) {
268 var $minimap = $table.prev().find( '.minimap' );
269 assert.ok( $minimap.length, 'Minimap exists.' );
270 // assert.ok( window.Tablesaw.MiniMap.showMiniMap( $table ), 'showMiniMap return true.' );
271 assert.equal( $minimap.css( "display" ), "block", 'Minimap is visible.' );
272 assert.equal( $minimap.find( 'li' ).length, $table.find( 'tbody tr' ).eq( 0 ) .find( 'td' ).length, 'Minimap has same number of dots as columns.' );
273 });
274
275 QUnit.module( 'tablesaw Mode Switch', {
276 beforeEach: setup( 'data-tablesaw-mode="stack" data-tablesaw-mode-switch' )
277 });
278
279 QUnit.test( 'Initialization', function( assert ) {
280 var $switcher = $table.prev().find( '.tablesaw-modeswitch' );
281 assert.ok( $switcher.length, 'Mode Switcher exists.' );
282 });
283
284 QUnit.test( 'Can switch to Swipe mode', function( assert ) {
285 var $switcher = $table.prev().find( '.tablesaw-modeswitch' ).find( 'select' );
286 assert.ok( !$table.is( '.tablesaw-swipe' ), 'Doesn’t have class.' );
287 $switcher.val( 'swipe' ).trigger( 'change' );
288 assert.ok( $table.is( '.tablesaw-swipe' ), 'Has class.' );
289 });
290
291 QUnit.test( 'Can switch to Column Toggle mode', function( assert ) {
292 var $switcher = $table.prev().find( '.tablesaw-modeswitch' ).find( 'select' );
293 assert.ok( !$table.is( '.tablesaw-columntoggle' ), 'Doesn’t have class.' );
294 $switcher.val( 'columntoggle' ).trigger( 'change' );
295 assert.ok( $table.is( '.tablesaw-columntoggle' ), 'Has class.' );
296 });
297
298 QUnit.module( 'tablesaw Stack Hide Empty', {
299 beforeEach: function(){
300 $fixture = $( '#qunit-fixture' );
301 $fixture.html( tableHtml.replace( /\%s/, 'data-tablesaw-mode="stack" data-tablesaw-hide-empty' ) );
302 $fixture.find( 'table tbody tr' ).eq( 3 ).find( 'td' ).eq( 4 ).html('');
303 $( document ).trigger( 'enhance.tablesaw' );
304 }
305 });
306
307 QUnit.test( 'Empty cells are hidden', function( assert ) {
308 $fixture = $( '#qunit-fixture' );
309 var testCell = $fixture.find( 'table tbody tr' ).eq( 3 ).find( 'td' ).eq( 4 );
310
311 //not sure how to better test this
312 if(window.innerWidth < 640){
313 assert.ok( $jQ( testCell[ 0 ] ).is(':hidden'));
314 }
315 else{
316 assert.ok( $jQ( testCell[ 0 ] ).is(':visible'));
317 }
318 });
319
320 QUnit.module ('tablesaw colspans', {
321 beforeEach: function() {
322 var colspannedHTML = [
323 '<table %s>',
324 '<thead>',
325 '<tr>',
326 '<th data-tablesaw-priority="1" colspan="2">Header 1</th>',
327 '<th data-tablesaw-priority="2" colspan="2">Header 2</th>',
328 '<th data-tablesaw-priority="6">Header 3</th>',
329 '</tr>',
330 '</thead>',
331 '<tbody>',
332 '<tr>',
333 '<td>Body Row 1</td>',
334 '<td>1</td>',
335 '<td>Small 1</td>',
336 '<td>Small 2</td>',
337 '<td>Small 3</td>',
338 '</tr>',
339 '<tr><td>Body Row 2</td><td>2</td><td colspan="2">Fat cell</td><td>After fat</td></tr>',
340 '<tr><td>Body Row 10</td><td>10</td><td>A</td><td>A</td><td>A</td></tr>',
341 '<tr><td>body row 4</td><td>10</td><td>A</td><td>A</td><td>A</td></tr>',
342 '<tr><td>Body Row 1.2</td><td>1.2</td><td>A</td><td>A</td><td>A</td></tr>',
343 '</tbody>',
344 '</table>'].join('');
345 $fixture = $( '#qunit-fixture' );
346 $fixture.html( colspannedHTML.replace( /\%s/, 'data-tablesaw-mode="columntoggle" data-tablesaw-minimap data-tablesaw-no-labels' ) );
347 $table = $fixture.find( 'table' );
348 $( document ).trigger( 'enhance.tablesaw' );
349 }
350 });
351
352 QUnit.test('Hide multicolumn header and single column cells', function( assert ) {
353 var $firstCell = $table.find( 'tbody td' ).eq( 0 );
354 var $secondCell = $table.find( 'tbody td' ).eq( 1 );
355
356 assert.strictEqual( $firstCell.is( '.tablesaw-toggle-cellhidden' ), false, 'First cell is visible before checkbox unchecked' );
357 assert.strictEqual( $secondCell.is( '.tablesaw-toggle-cellhidden' ), false, 'Second cell is visible before checkbox unchecked' );
358
359 $table.prev().find( '.tablesaw-columntoggle-btn' ).trigger( 'click' )
360 .next().find( 'input[type="checkbox"]' ).first().trigger( 'click' );
361
362 // close dialog
363 $( '.tablesaw-columntoggle-popup .close' ).trigger( "click" );
364
365 assert.strictEqual( $firstCell.is( '.tablesaw-toggle-cellhidden' ), true, 'First cell is hidden after checkbox unchecked' );
366 assert.strictEqual( $secondCell.is( '.tablesaw-toggle-cellhidden' ), true, 'Second cell is hidden after checkbox unchecked' );
367 });
368
369 QUnit.test('Hide multicolumn header and multi column cells', function( assert ) {
370 var $firstRowCell1 = $table.find( 'tbody tr' ).eq( 0 ).find( 'td' ).eq( 2 );
371 var $firstRowCell2 = $table.find( 'tbody tr' ).eq( 0 ).find( 'td' ).eq( 3 );
372 var $firstRowCell3 = $table.find( 'tbody tr' ).eq( 0 ).find( 'td' ).eq( 4 );
373 var $secondRowFatCell = $table.find( 'tbody tr' ).eq( 1 ).find( 'td' ).eq( 2 );
374 var $secondRowLastCell = $table.find( 'tbody tr' ).eq( 1 ).find( 'td' ).eq( 3 );
375
376 assert.strictEqual( $firstRowCell1.is( '.tablesaw-toggle-cellhidden' ), false, 'Cell 0,2 cell is visible before checkbox unchecked' );
377 assert.strictEqual( $firstRowCell2.is( '.tablesaw-toggle-cellhidden' ), false, 'Cell 0,3 is visible before checkbox unchecked' );
378 assert.strictEqual( $firstRowCell3.is( '.tablesaw-toggle-cellhidden' ), false, 'Cell 0,4 is visible before checkbox unchecked' );
379 assert.strictEqual( $secondRowFatCell.is( '.tablesaw-toggle-cellhidden' ), false, 'Cell 1,2-3 is visible before checkbox unchecked' );
380 assert.strictEqual( $secondRowLastCell.is( '.tablesaw-toggle-cellhidden' ), false, 'Cell 1,4 is visible before checkbox unchecked' );
381
382 var middlecheck = $($table.prev().find( '.tablesaw-columntoggle-btn' ).trigger( 'click' )
383 .next().find( 'input[type="checkbox"]' )[1]);
384 if (!middlecheck[0].checked) {
385 middlecheck.trigger( 'click' );
386 assert.strictEqual ( middlecheck[0].checked, true, "Toggle button wasn't initially true and then should've been turned on.");
387 }
388 middlecheck.trigger( 'click' );
389 assert.strictEqual ( middlecheck[0].checked, false, "Toggle button wasn't unchecked.");
390
391 // close dialog
392 $( '.tablesaw-columntoggle-popup .close' ).trigger( "click" );
393
394 assert.strictEqual( $firstRowCell1.is( '.tablesaw-toggle-cellhidden' ), true, 'Cell 0,2 cell is hidden after checkbox unchecked' );
395 assert.strictEqual( $firstRowCell2.is( '.tablesaw-toggle-cellhidden' ), true, 'Cell 0,3 is hidden after checkbox unchecked' );
396 assert.strictEqual( $firstRowCell3.is( '.tablesaw-toggle-cellhidden' ), false, 'Cell 0,4 is still visible after checkbox unchecked' );
397 assert.strictEqual( $secondRowFatCell.is( '.tablesaw-toggle-cellhidden' ), true, 'Cell 1,2-3 is hidden after checkbox unchecked' );
398 assert.strictEqual( $secondRowLastCell.is( '.tablesaw-toggle-cellhidden' ), false, 'Cell 1,4 is still visible after checkbox unchecked' );
399 });
400
401 QUnit.test('Hide single column header and not multi column cells', function( assert ) {
402 var $firstRowCell1 = $table.find( 'tbody tr' ).eq( 0 ).find( 'td' ).eq( 2 );
403 var $firstRowCell2 = $table.find( 'tbody tr' ).eq( 0 ).find( 'td' ).eq( 3 );
404 var $firstRowCell3 = $table.find( 'tbody tr' ).eq( 0 ).find( 'td' ).eq( 4 );
405 var $secondRowFatCell = $table.find( 'tbody tr' ).eq( 1 ).find( 'td' ).eq( 2 );
406 var $secondRowLastCell = $table.find( 'tbody tr' ).eq( 1 ).find( 'td' ).eq( 3 );
407
408 assert.strictEqual( $firstRowCell1.is( '.tablesaw-toggle-cellhidden' ), false, 'Cell 0,2 cell is visible before checkbox unchecked' );
409 assert.strictEqual( $firstRowCell2.is( '.tablesaw-toggle-cellhidden' ), false, 'Cell 0,3 is visible before checkbox unchecked' );
410 assert.strictEqual( $firstRowCell3.is( '.tablesaw-toggle-cellhidden' ), false, 'Cell 0,4 is visible before checkbox unchecked' );
411 assert.strictEqual( $secondRowFatCell.is( '.tablesaw-toggle-cellhidden' ), false, 'Cell 1,2-3 is visible before checkbox unchecked' );
412 assert.strictEqual( $secondRowLastCell.is( '.tablesaw-toggle-cellhidden' ), false, 'Cell 1,4 is visible before checkbox unchecked' );
413
414 var lastcheck = $table.prev().find( '.tablesaw-columntoggle-btn' ).trigger( 'click' )
415 .next().find( 'input[type="checkbox"]').last();
416 if (!lastcheck[0].checked) {
417 lastcheck.trigger( 'click' );
418 assert.strictEqual ( lastcheck[0].checked, true, "Toggle button wasn't initially true and then should've been turned on.");
419 }
420 lastcheck.trigger( 'click' );
421 assert.strictEqual ( lastcheck[0].checked, false, "Toggle button wasn't unchecked.");
422
423 // close dialog
424 $( '.tablesaw-columntoggle-popup .close' ).trigger( "click" );
425
426 assert.strictEqual( $firstRowCell1.is( '.tablesaw-toggle-cellhidden' ), false, 'Cell 0,2 cell is visible after checkbox unchecked' );
427 assert.strictEqual( $firstRowCell2.is( '.tablesaw-toggle-cellhidden' ), false, 'Cell 0,3 is visible after checkbox unchecked' );
428 assert.strictEqual( $firstRowCell3.is( '.tablesaw-toggle-cellhidden' ), true, 'Cell 0,4 is hidden after checkbox unchecked' );
429 assert.strictEqual( $secondRowFatCell.is( '.tablesaw-toggle-cellhidden' ), false, 'Cell 1,2-3 is visible after checkbox unchecked' );
430 assert.strictEqual( $secondRowLastCell.is( '.tablesaw-toggle-cellhidden' ), true, 'Cell 1,4 is hidden after checkbox unchecked' );
431 });
432
433 }( window.shoestring || window.jQuery || window.$jQ ));