1 |
|
2 | (function(win, TableFilter){
|
3 |
|
4 | var tf = new TableFilter('demo', {
|
5 | base_path: '../dist/tablefilter/',
|
6 | col_widths: ['150px', '100px', '175px', '120px', null]
|
7 | });
|
8 | tf.init();
|
9 |
|
10 | module('Sanity checks');
|
11 | test('Column widths', function() {
|
12 | var cols = tf.dom().getElementsByTagName('col');
|
13 | deepEqual(tf instanceof TableFilter, true, 'TableFilter instanciated');
|
14 | deepEqual(cols[1].style.width, '100px', 'Expected column width');
|
15 | deepEqual(cols[4].style.width, '', 'Expected column width');
|
16 | deepEqual(tf.dom().style.width, '645px', 'Table width set');
|
17 | deepEqual(tf.dom().style.tableLayout, 'fixed', 'Table layout fixed');
|
18 | });
|
19 |
|
20 | test('Grid layout column widths', function() {
|
21 | tf.destroy();
|
22 | tf = null;
|
23 | tf = new TableFilter('demo', {
|
24 | base_path: '../dist/tablefilter/',
|
25 | col_widths: ['150px', '100px', '175px', '120px', null],
|
26 | grid_layout: true
|
27 | });
|
28 | tf.init();
|
29 | var gridLayout = tf.feature('gridLayout');
|
30 | var cols = gridLayout.headTbl.getElementsByTagName('col');
|
31 | deepEqual(cols[0].style.width, '150px', 'Expected column width');
|
32 | deepEqual(cols[3].style.width, '120px', 'Expected column width');
|
33 | deepEqual(
|
34 | tf.dom().style.width === gridLayout.headTbl.style.width,
|
35 | true,
|
36 | 'Content and headers table have same width'
|
37 | );
|
38 | });
|
39 |
|
40 | })(window, TableFilter);
|