2015-03-06 09:49:30 +01:00
|
|
|
requirejs(['test-config', '../src/tablefilter'], function(config, TableFilter){
|
2014-11-16 01:29:07 +01:00
|
|
|
|
|
|
|
QUnit.start();
|
|
|
|
|
2014-11-23 04:34:57 +01:00
|
|
|
var RowsCounter = require('modules/rowsCounter').RowsCounter;
|
2015-01-26 10:31:25 +01:00
|
|
|
var Paging = require('modules/paging').Paging;
|
2014-11-16 01:29:07 +01:00
|
|
|
|
|
|
|
var tf = new TableFilter('demo', {
|
|
|
|
rows_counter: true
|
|
|
|
});
|
|
|
|
tf.init();
|
|
|
|
|
|
|
|
module('Sanity checks');
|
|
|
|
test('RowsCounter component', function() {
|
2014-11-23 04:34:57 +01:00
|
|
|
deepEqual(tf.Cpt.rowsCounter instanceof RowsCounter, true, 'RowsCounter type');
|
2014-11-16 01:29:07 +01:00
|
|
|
notEqual(tf.Cpt.rowsCounter, null, 'RowsCounter instanciated');
|
|
|
|
});
|
|
|
|
|
|
|
|
test('RowsCounter component with paging', function() {
|
2015-01-26 10:31:25 +01:00
|
|
|
tf.Cpt.paging = new Paging(tf);
|
|
|
|
var paging = tf.Cpt.paging;
|
|
|
|
paging.addPaging();
|
2014-11-16 01:29:07 +01:00
|
|
|
equal(tf.Cpt.rowsCounter.rowsCounterSpan.innerHTML, '1-7 / 7', 'Counter value with paging');
|
2015-01-26 10:31:25 +01:00
|
|
|
paging.destroy();
|
|
|
|
});
|
|
|
|
|
|
|
|
test('RowsCounter component without paging', function() {
|
|
|
|
tf.Cpt.rowsCounter.refresh();
|
|
|
|
equal(tf.Cpt.rowsCounter.rowsCounterSpan.innerHTML, 7, 'Counter value');
|
2014-11-16 01:29:07 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
});
|