1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-04-25 11:40:47 +02:00
TableFilter/test/test-col-widths.js
2018-04-07 10:45:33 +10:00

41 lines
1.4 KiB
JavaScript

(function(win, TableFilter){
var tf = new TableFilter('demo', {
base_path: '../dist/tablefilter/',
col_widths: ['150px', '100px', '175px', '120px', null]
});
tf.init();
module('Sanity checks');
test('Column widths', function() {
var cols = tf.dom().getElementsByTagName('col');
deepEqual(tf instanceof TableFilter, true, 'TableFilter instanciated');
deepEqual(cols[1].style.width, '100px', 'Expected column width');
deepEqual(cols[4].style.width, '', 'Expected column width');
deepEqual(tf.dom().style.width, '645px', 'Table width set');
deepEqual(tf.dom().style.tableLayout, 'fixed', 'Table layout fixed');
});
test('Grid layout column widths', function() {
tf.destroy();
tf = null;
tf = new TableFilter('demo', {
base_path: '../dist/tablefilter/',
col_widths: ['150px', '100px', '175px', '120px', null],
grid_layout: true
});
tf.init();
var gridLayout = tf.feature('gridLayout');
var cols = gridLayout.headTbl.getElementsByTagName('col');
deepEqual(cols[0].style.width, '150px', 'Expected column width');
deepEqual(cols[3].style.width, '120px', 'Expected column width');
deepEqual(
tf.dom().style.width === gridLayout.headTbl.style.width,
true,
'Content and headers table have same width'
);
});
})(window, TableFilter);