1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-28 03:23:06 +02:00
TableFilter/test/test-rows-counter.js

41 lines
1,018 B
JavaScript
Raw Normal View History

2014-11-16 01:29:07 +01:00
2015-05-14 12:08:19 +02:00
var tf = new TableFilter('demo', {
base_path: '../dist/tablefilter/',
rows_counter: true
});
tf.init();
2014-11-16 01:29:07 +01:00
2015-05-14 12:08:19 +02:00
module('Sanity checks');
test('RowsCounter component', function() {
notEqual(tf.feature('rowsCounter'), null, 'RowsCounter instanciated');
2015-05-14 12:08:19 +02:00
});
2015-07-01 10:01:52 +02:00
test('RowsCounter component', function() {
2015-06-13 11:03:33 +02:00
equal(tf.feature('rowsCounter').rowsCounterSpan.innerHTML,
2015-07-01 10:01:52 +02:00
7, 'Counter value');
2015-05-14 12:08:19 +02:00
});
2014-11-16 01:29:07 +01:00
2015-07-01 10:01:52 +02:00
test('RowsCounter component with filtered table', function() {
tf.setFilterValue(0, 'Syd');
tf.filter();
2015-06-13 11:03:33 +02:00
equal(tf.feature('rowsCounter').rowsCounterSpan.innerHTML,
2015-07-01 10:01:52 +02:00
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');
2014-11-16 01:29:07 +01:00
});