1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-19 06:47:00 +02:00
TableFilter/test/test-rows-counter.js
2015-07-01 18:01:52 +10:00

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