1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2026-03-16 23:55:46 +01:00
TableFilter/test/test-rows-counter.js
Max Guglielmi 1092cc2eb5 Fixed tests
2015-07-01 18:01:52 +10:00

40 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');
});