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() {
|
2015-06-07 17:31:15 +02:00
|
|
|
notEqual(tf.feature('rowsCounter'), null, 'RowsCounter instanciated');
|
2015-05-14 12:08:19 +02:00
|
|
|
});
|
2015-01-26 10:31:25 +01: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
|
|
|
});
|