1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2026-03-16 07:35:45 +01:00

Continued increasing coverage

This commit is contained in:
Max Guglielmi 2016-12-08 22:16:47 +11:00
commit 8dee7d0cfb
15 changed files with 54 additions and 37 deletions

View file

@ -127,6 +127,12 @@ test('Clear filters', function() {
deepEqual(tf.getFiltersValue(), ['', '', '', '', '']);
});
test('Can get feature', function() {
var feature = tf.feature('help');
deepEqual(typeof feature, 'object', 'Feature instance');
deepEqual(feature.feature, 'help', 'Feature name');
});
test('Get table data', function() {
deepEqual(tf.getColValues(0),
[

View file

@ -108,6 +108,18 @@
deepEqual(tf.getValidRows(), [6], 'Expected rows');
});
test('Can filter a number', function() {
// setup
tf.clearFilters();
// act
tf.setFilterValue(4, 1836.09);
tf.filter();
// assert
deepEqual(tf.getValidRows(), [6], 'Expected rows');
});
test('Can filter a formatted number column with a number', function() {
// setup
tf.clearFilters();
@ -270,10 +282,10 @@
deepEqual(tf.getValidRows().length, 8, 'Expected rows');
});
module('Tear-down');
test('can destroy TableFilter DOM elements', function() {
tf.destroy();
deepEqual(tf.isInitialized(), false, 'Filters removed');
});
// module('Tear-down');
// test('can destroy TableFilter DOM elements', function() {
// tf.destroy();
// deepEqual(tf.isInitialized(), false, 'Filters removed');
// });
})(window, TableFilter);

View file

@ -79,7 +79,7 @@
deepEqual(tf1.getFilterElement(0), null, 'Filter 0 removed');
});
module('DOM table does not exist');
module('Edge cases');
test('throws when no working DOM element', function() {
throws(
function() { new TableFilter('xyz'); },
@ -87,5 +87,9 @@
'Throws Error when no DOM table'
);
});
test('Can instantiate with wrong refRow', function() {
var tf2 = new TableFilter('demo', -9);
deepEqual(tf2.nbCells, 5, 'Expected number of columns');
});
})(window, TableFilter);