mirror of
https://github.com/koalyptus/TableFilter.git
synced 2026-03-16 15:45:45 +01:00
Started feature base class for grid layout
This commit is contained in:
parent
bba32b2ff3
commit
f2c5bf33f5
19 changed files with 753 additions and 152 deletions
|
|
@ -141,3 +141,9 @@ test('Grid layout: remove alternating rows', function() {
|
|||
deepEqual(tbl.querySelectorAll('tr.odd').length, 0, 'Odd bgs removed');
|
||||
deepEqual(tbl.querySelectorAll('tr.even').length, 0, 'Even bg removed');
|
||||
});
|
||||
|
||||
module('Tear-down');
|
||||
test('can destroy TableFilter DOM elements', function() {
|
||||
tf.destroy();
|
||||
deepEqual(tf.hasGrid(), false, 'Filters removed');
|
||||
});
|
||||
|
|
|
|||
|
|
@ -12,11 +12,58 @@ test('Clear button component', function() {
|
|||
notEqual(clearButton.btnResetEl, null, 'btnResetEl property');
|
||||
});
|
||||
|
||||
module('Feature interface');
|
||||
test('Properties', function() {
|
||||
deepEqual(
|
||||
clearButton.tf instanceof TableFilter, true, 'TableFilter instance');
|
||||
deepEqual(clearButton.feature, 'btnReset', 'Feature name');
|
||||
deepEqual(clearButton.enabled, true, 'Feature enabled');
|
||||
deepEqual(clearButton.initialized, true, 'Feature enabled');
|
||||
deepEqual(typeof clearButton.config, 'object', 'TF configuration object');
|
||||
deepEqual(typeof clearButton.init, 'function', 'Feature init method');
|
||||
deepEqual(typeof clearButton.destroy, 'function', 'Feature destroy method');
|
||||
deepEqual(typeof clearButton.reset, 'function', 'Feature reset method');
|
||||
deepEqual(typeof clearButton.enable, 'function', 'Feature enable method');
|
||||
deepEqual(typeof clearButton.disable, 'function', 'Feature enable method');
|
||||
deepEqual(
|
||||
typeof clearButton.isEnabled, 'function', 'Feature enable method');
|
||||
});
|
||||
test('Can destroy', function() {
|
||||
clearButton.destroy();
|
||||
deepEqual(clearButton.enabled, false, 'disabled');
|
||||
});
|
||||
test('Can reset', function() {
|
||||
clearButton.reset();
|
||||
deepEqual(clearButton.enabled, true, 'enabled');
|
||||
});
|
||||
test('Can disable', function() {
|
||||
clearButton.disable();
|
||||
deepEqual(clearButton.enabled, false, 'disabled');
|
||||
});
|
||||
test('Can enable', function() {
|
||||
clearButton.enable();
|
||||
deepEqual(clearButton.enabled, true, 'enabled');
|
||||
});
|
||||
test('Can init', function() {
|
||||
clearButton.destroy();
|
||||
clearButton.enable();
|
||||
clearButton.init();
|
||||
deepEqual(clearButton.enabled, true, 'enabled');
|
||||
});
|
||||
test('Can check is enabled', function() {
|
||||
clearButton.isEnabled();
|
||||
deepEqual(clearButton.enabled, true, 'enabled');
|
||||
});
|
||||
|
||||
module('UI elements');
|
||||
test('ClearButton UI elements', function() {
|
||||
var container = clearButton.btnResetEl;
|
||||
deepEqual(container.nodeName, 'INPUT', 'Clear button container');
|
||||
deepEqual(container.parentNode.id, clearButton.prfxResetSpan+tf.id, 'Container id');
|
||||
deepEqual(
|
||||
container.parentNode.id,
|
||||
clearButton.prfxResetSpan+tf.id,
|
||||
'Container id'
|
||||
);
|
||||
});
|
||||
|
||||
module('Destroy and re-init');
|
||||
|
|
@ -28,12 +75,18 @@ test('Remove UI', function() {
|
|||
|
||||
test('Re-set UI', function() {
|
||||
tf.enableIcons = false;
|
||||
tf.feature('clearButton').btnResetHtml = null;
|
||||
tf.feature('clearButton').btnResetText = 'Clear';
|
||||
tf.feature('clearButton').init();
|
||||
clearButton = tf.feature('clearButton');
|
||||
clearButton.btnResetHtml = null;
|
||||
clearButton.btnResetText = 'Clear';
|
||||
clearButton.init();
|
||||
|
||||
var btnResetEl = tf.feature('clearButton').btnResetEl;
|
||||
var btnResetEl = clearButton.btnResetEl;
|
||||
deepEqual(btnResetEl.nodeName, 'A', 'Clear button tag changed');
|
||||
deepEqual(btnResetEl.innerText, 'Clear', 'Clear button text');
|
||||
});
|
||||
|
||||
module('Tear-down');
|
||||
test('can destroy TableFilter DOM elements', function() {
|
||||
tf.destroy();
|
||||
deepEqual(tf.hasGrid(), false, 'Filters removed');
|
||||
});
|
||||
|
|
|
|||
|
|
@ -207,6 +207,10 @@ test('Set results per page', function() {
|
|||
paging.changeResultsPerPage();
|
||||
deepEqual(paging.pagingLength, 6, 'Expected page length');
|
||||
deepEqual(paging.nbPages, 2, 'Expected number of pages');
|
||||
|
||||
tf.destroy();
|
||||
});
|
||||
|
||||
module('Tear-down');
|
||||
test('can destroy TableFilter DOM elements', function() {
|
||||
tf.destroy();
|
||||
deepEqual(tf.hasGrid(), false, 'Filters removed');
|
||||
});
|
||||
|
|
|
|||
|
|
@ -83,3 +83,9 @@ test('RowsCounter component with paging', function() {
|
|||
equal(tf.feature('rowsCounter').rowsCounterSpan.innerHTML,
|
||||
'1-7 / 7', 'Counter value with paging');
|
||||
});
|
||||
|
||||
module('Tear-down');
|
||||
test('can destroy TableFilter DOM elements', function() {
|
||||
tf.destroy();
|
||||
deepEqual(tf.hasGrid(), false, 'Filters removed');
|
||||
});
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ function startPaging(tf, sort){
|
|||
deepEqual(sort.stt instanceof SortableTable, true, 'Sort type');
|
||||
deepEqual(sort.sorted, false, 'Table not sorted');
|
||||
deepEqual(sort.initialized, true, 'Sort initialized');
|
||||
deepEqual(tf.paging, true, 'Table is paged');
|
||||
});
|
||||
|
||||
module('UI elements');
|
||||
|
|
@ -71,9 +72,7 @@ function startPaging(tf, sort){
|
|||
|
||||
test('Sort behaviour', function() {
|
||||
sort.sortByColumnIndex(0);
|
||||
|
||||
deepEqual(sort.sorted, true, 'Table column sorted');
|
||||
deepEqual(tf.paging, true, 'Table is paged');
|
||||
});
|
||||
|
||||
module('Destroy and re-init');
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ function startPaging(tf, sort){
|
|||
deepEqual(sort.stt instanceof SortableTable, true, 'Sort type');
|
||||
deepEqual(sort.sorted, false, 'Table not sorted');
|
||||
deepEqual(sort.initialized, true, 'Sort initialized');
|
||||
deepEqual(tf.paging, true, 'Table is paged');
|
||||
});
|
||||
|
||||
module('UI elements');
|
||||
|
|
@ -112,7 +113,6 @@ function startPaging(tf, sort){
|
|||
sort.sortByColumnIndex(0);
|
||||
|
||||
deepEqual(sort.sorted, true, 'Table column sorted');
|
||||
deepEqual(tf.paging, true, 'Table is paged');
|
||||
});
|
||||
|
||||
module('Destroy and re-init');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue