mirror of
https://github.com/koalyptus/TableFilter.git
synced 2024-06-19 22:25:18 +02:00
41 lines
1,018 B
JavaScript
41 lines
1,018 B
JavaScript
|
|
var tf = new TableFilter('demo', {
|
|
base_path: '../dist/tablefilter/',
|
|
rows_counter: true
|
|
});
|
|
tf.init();
|
|
|
|
module('Sanity checks');
|
|
test('RowsCounter component', function() {
|
|
notEqual(tf.feature('rowsCounter'), null, 'RowsCounter instanciated');
|
|
});
|
|
|
|
test('RowsCounter component', function() {
|
|
equal(tf.feature('rowsCounter').rowsCounterSpan.innerHTML,
|
|
7, 'Counter value');
|
|
});
|
|
|
|
test('RowsCounter component with filtered table', function() {
|
|
tf.setFilterValue(0, 'Syd');
|
|
tf.filter();
|
|
|
|
equal(tf.feature('rowsCounter').rowsCounterSpan.innerHTML,
|
|
4, 'Counter value');
|
|
|
|
tf.clearFilters();
|
|
});
|
|
|
|
module('With pagination');
|
|
test('RowsCounter component with paging', function() {
|
|
tf.destroy();
|
|
tf = null;
|
|
tf = new TableFilter('demo', {
|
|
base_path: '../dist/tablefilter/',
|
|
rows_counter: true,
|
|
paging: true
|
|
});
|
|
tf.init();
|
|
equal(tf.feature('rowsCounter').rowsCounterSpan.innerHTML,
|
|
'1-7 / 7', 'Counter value with paging');
|
|
});
|