2015-05-28 15:44:23 +02:00
|
|
|
|
|
|
|
(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() {
|
2017-04-14 11:30:58 +02:00
|
|
|
var cols = tf.dom().getElementsByTagName('col');
|
2015-05-28 15:44:23 +02:00
|
|
|
deepEqual(tf instanceof TableFilter, true, 'TableFilter instanciated');
|
2015-06-06 14:22:13 +02:00
|
|
|
deepEqual(cols[1].style.width, '100px', 'Expected column width');
|
|
|
|
deepEqual(cols[4].style.width, '', 'Expected column width');
|
2018-04-07 02:45:33 +02:00
|
|
|
deepEqual(tf.dom().style.width, '645px', 'Table width set');
|
2018-04-02 10:01:28 +02:00
|
|
|
deepEqual(tf.dom().style.tableLayout, 'fixed', 'Table layout fixed');
|
2015-05-28 15:44:23 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
test('Grid layout column widths', function() {
|
|
|
|
tf.destroy();
|
|
|
|
tf = null;
|
|
|
|
tf = new TableFilter('demo', {
|
|
|
|
base_path: '../dist/tablefilter/',
|
2018-04-07 02:45:33 +02:00
|
|
|
col_widths: ['150px', '100px', '175px', '120px', null],
|
2017-07-09 07:11:51 +02:00
|
|
|
grid_layout: true
|
2015-05-28 15:44:23 +02:00
|
|
|
});
|
|
|
|
tf.init();
|
2017-09-23 13:34:09 +02:00
|
|
|
var gridLayout = tf.feature('gridLayout');
|
|
|
|
var cols = gridLayout.headTbl.getElementsByTagName('col');
|
2015-06-06 14:22:13 +02:00
|
|
|
deepEqual(cols[0].style.width, '150px', 'Expected column width');
|
2018-04-07 02:45:33 +02:00
|
|
|
deepEqual(cols[3].style.width, '120px', 'Expected column width');
|
2017-09-23 13:34:09 +02:00
|
|
|
deepEqual(
|
|
|
|
tf.dom().style.width === gridLayout.headTbl.style.width,
|
|
|
|
true,
|
|
|
|
'Content and headers table have same width'
|
|
|
|
);
|
2015-05-28 15:44:23 +02:00
|
|
|
});
|
|
|
|
|
2015-06-06 14:22:13 +02:00
|
|
|
})(window, TableFilter);
|