1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-09 18:06:53 +02:00

Increasing TableFilter class Coverage

This commit is contained in:
Max Guglielmi 2017-01-24 14:06:29 +11:00
parent 2e3e68bb6f
commit b3910ca837
3 changed files with 31 additions and 1 deletions

View file

@ -1,6 +1,6 @@
{
"name": "tablefilter",
"version": "0.4.37",
"version": "0.4.38",
"description": "A Javascript library making HTML tables filterable and a bit more",
"license": "MIT",
"author": {

View file

@ -9,9 +9,17 @@
col_1: 'checklist',
on_after_reset: testClearFilters
});
var ct = 0;
tf.emitter.on(['build-checklist-filter'], function() {
ct++;
});
tf.init();
tf.setFilterValue(0, 'Sydney');
tf.getFilterElement(0).focus();
tf.filter();
module('Sanity checks');
@ -19,7 +27,11 @@
deepEqual(tf instanceof TableFilter, true, 'TableFilter instantiated');
deepEqual(tf.linkedFilters, true, 'Linked filters enabled');
tf.activateFilter(0);
tf.clearFilters();
deepEqual(ct, 2,
'build-checklist-filter event emitted after filtering');
tf.onAfterFilter = null;
tf.destroy();
tf = null;

View file

@ -85,6 +85,24 @@
deepEqual(ct, 0, 'Filters not cleared');
});
test('cannot _initNoFilters if there are filters', function() {
// setup
tf.fltGrid = true;
var getRowsNb = this.getRowsNb;
var ct = 0;
tf.getRowsNb = function(){
ct++;
};
// act
tf._initNoFilters();
// assert
deepEqual(ct, 0, '_initNoFilters not executed');
tf.getRowsNb = getRowsNb;
});
module('Paging on');
test('Paging with no filters', function() {
// setup