mirror of
https://github.com/koalyptus/TableFilter.git
synced 2024-05-13 03:46:41 +02:00
Finalised columns visibility extension tests
This commit is contained in:
parent
fe7ef862ec
commit
430e68ab05
4
dist/tablefilter/tablefilter.js
vendored
4
dist/tablefilter/tablefilter.js
vendored
File diff suppressed because one or more lines are too long
9
dist/tablefilter/tf-6d6057e5f675c1a47c23.js
vendored
Normal file
9
dist/tablefilter/tf-6d6057e5f675c1a47c23.js
vendored
Normal file
File diff suppressed because one or more lines are too long
9
dist/tablefilter/tf-ded87c3d579ac7ac73d0.js
vendored
9
dist/tablefilter/tf-ded87c3d579ac7ac73d0.js
vendored
File diff suppressed because one or more lines are too long
|
@ -69,82 +69,64 @@
|
|||
deepEqual(ext.contEl, null, 'Columns list container removed');
|
||||
deepEqual(ext.btnEl, null, 'Button removed');
|
||||
});
|
||||
test('Re-initialize extension', function() {
|
||||
ext = tf.getExtension('colsVisibility');
|
||||
ext.init();
|
||||
deepEqual(ext.initialized, true, 'Extension initialized');
|
||||
tf.destroy();
|
||||
});
|
||||
|
||||
// module('Behaviour');
|
||||
// test('Filter column with custom filter', function() {
|
||||
// var flt = tf.getFilterElement(3);
|
||||
// flt.selectedIndex = flt.options.length-1;
|
||||
// tf.filter();
|
||||
module('Behaviour with grid layout');
|
||||
test('Re-initialize tablefilter with grid layout on', function() {
|
||||
tf = null;
|
||||
tf = new TableFilter('demo', {
|
||||
base_path: '../dist/tablefilter/',
|
||||
grid_layout: true,
|
||||
extensions:[{ name: 'colsVisibility' }]
|
||||
});
|
||||
tf.init();
|
||||
|
||||
// deepEqual(
|
||||
// tf.getFilteredData().length, 2, 'Expected nb of filtered rows');
|
||||
ext = tf.getExtension('colsVisibility');
|
||||
deepEqual(ext.initialized, true, 'Extension initialized');
|
||||
});
|
||||
test('Toggle columns list container', function() {
|
||||
ext = tf.getExtension('colsVisibility');
|
||||
ext.toggle();
|
||||
deepEqual(ext.contEl.style.display, 'inline', 'columns list visible');
|
||||
|
||||
// tf.clearFilters();
|
||||
ext.toggle();
|
||||
deepEqual(ext.contEl.style.display, 'none', 'columns list visible');
|
||||
});
|
||||
test('Hide columns', function() {
|
||||
ext = tf.getExtension('colsVisibility');
|
||||
ext.hideCol(2);
|
||||
ext.hideCol(3);
|
||||
deepEqual(ext.isColHidden(2), true, 'Expected column is hidden');
|
||||
deepEqual(ext.isColHidden(3), true, 'Expected column is hidden');
|
||||
});
|
||||
test('Show columns', function() {
|
||||
ext = tf.getExtension('colsVisibility');
|
||||
ext.showCol(2);
|
||||
ext.showCol(3);
|
||||
deepEqual(ext.isColHidden(2), false, 'Expected column is displayed');
|
||||
deepEqual(ext.isColHidden(3), false, 'Expected column is displayed');
|
||||
});
|
||||
test('Toggle column', function() {
|
||||
ext = tf.getExtension('colsVisibility');
|
||||
ext.toggleCol(2);
|
||||
deepEqual(ext.isColHidden(2), true, 'Expected column is hidden');
|
||||
|
||||
// deepEqual(
|
||||
// tf.getFilteredData().length, 7, 'Expected nb of filtered rows');
|
||||
// });
|
||||
ext.toggleCol(2);
|
||||
deepEqual(ext.isColHidden(2), false, 'Expected column is displayed');
|
||||
});
|
||||
test('Destroy extension and tablefilter', function() {
|
||||
ext = tf.getExtension('colsVisibility');
|
||||
ext.destroy();
|
||||
deepEqual(ext.initialized, false, 'Extension no longer initialized');
|
||||
deepEqual(ext.contEl, null, 'Columns list container removed');
|
||||
deepEqual(ext.btnEl, null, 'Button removed');
|
||||
|
||||
// test('Paging: filter column with custom filter', function() {
|
||||
// tf.destroy();
|
||||
// tf = null;
|
||||
// tf = new TableFilter('demo', {
|
||||
// col_3: 'select',
|
||||
// custom_options: {
|
||||
// cols: [3],
|
||||
// texts: [['0-0.5', '0.5-1', '1-2', '>2']],
|
||||
// values: [['>0 && <=0.5', '>0.5 && <=1', '>1 && <=2', '>2']],
|
||||
// sorts: [false]
|
||||
// },
|
||||
// paging: true,
|
||||
// paging_length: 3
|
||||
// });
|
||||
// tf.init();
|
||||
|
||||
// var flt = tf.getFilterElement(3);
|
||||
// flt.selectedIndex = flt.options.length-1;
|
||||
// tf.filter();
|
||||
|
||||
// deepEqual(
|
||||
// tf.getFilteredData().length, 2, 'Expected nb of filtered rows');
|
||||
|
||||
// tf.clearFilters();
|
||||
|
||||
// deepEqual(
|
||||
// tf.getFilteredData().length, 7, 'Expected nb of filtered rows');
|
||||
|
||||
// tf.destroy();
|
||||
// tf = null;
|
||||
// });
|
||||
|
||||
// test('Grid layout: filter column with custom filter', function() {
|
||||
// tf = new TableFilter('demo', {
|
||||
// base_path: '../dist/tablefilter/',
|
||||
// col_3: 'select',
|
||||
// custom_options: {
|
||||
// cols: [3],
|
||||
// texts: [['0-0.5', '0.5-1', '1-2', '>2']],
|
||||
// values: [['>0 && <=0.5', '>0.5 && <=1', '>1 && <=2', '>2']],
|
||||
// sorts: [false]
|
||||
// },
|
||||
// grid_layout: true
|
||||
// });
|
||||
// tf.init();
|
||||
|
||||
// var flt = tf.getFilterElement(3);
|
||||
// flt.selectedIndex = flt.options.length-1;
|
||||
// tf.filter();
|
||||
|
||||
// deepEqual(
|
||||
// tf.getFilteredData().length, 2, 'Expected nb of filtered rows');
|
||||
|
||||
// tf.clearFilters();
|
||||
|
||||
// deepEqual(
|
||||
// tf.getFilteredData().length, 7, 'Expected nb of filtered rows');
|
||||
|
||||
// tf.destroy();
|
||||
// tf = null;
|
||||
// });
|
||||
tf.destroy();
|
||||
});
|
||||
|
||||
})(window, TableFilter);
|
||||
|
|
Loading…
Reference in a new issue