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:
parent
2e3e68bb6f
commit
b3910ca837
|
@ -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": {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue