2015-02-19 06:28:50 +01:00
|
|
|
|
2015-05-10 13:12:31 +02:00
|
|
|
var tf = new TableFilter('demo', {
|
2015-05-15 12:37:27 +02:00
|
|
|
base_path: '../dist/tablefilter/',
|
2015-05-10 13:12:31 +02:00
|
|
|
btn_reset: true
|
|
|
|
});
|
|
|
|
tf.init();
|
2015-02-19 06:28:50 +01:00
|
|
|
|
2015-05-10 13:12:31 +02:00
|
|
|
var clearButton = tf.Cpt.clearButton;
|
|
|
|
module('Sanity checks');
|
|
|
|
test('Clear button component', function() {
|
|
|
|
deepEqual(typeof clearButton, 'object', 'ClearButton instanciated');
|
|
|
|
notEqual(clearButton.btnResetEl, null, 'btnResetEl property');
|
|
|
|
});
|
2015-02-19 06:28:50 +01:00
|
|
|
|
2015-05-10 13:12:31 +02:00
|
|
|
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');
|
|
|
|
});
|
2015-02-19 06:28:50 +01:00
|
|
|
|
2015-05-10 13:12:31 +02:00
|
|
|
module('Destroy and re-init');
|
|
|
|
test('Remove UI', function() {
|
|
|
|
clearButton.destroy();
|
|
|
|
var btnResetEl = tf.Cpt.clearButton.btnResetEl;
|
|
|
|
deepEqual(btnResetEl, null, 'Clear button is removed');
|
|
|
|
});
|
2015-02-19 06:28:50 +01:00
|
|
|
|
2015-05-10 13:12:31 +02:00
|
|
|
test('Re-set UI', function() {
|
|
|
|
tf.enableIcons = false;
|
|
|
|
tf.Cpt.clearButton.btnResetHtml = null;
|
|
|
|
tf.Cpt.clearButton.btnResetText = 'Clear';
|
|
|
|
tf.Cpt.clearButton.init();
|
2015-02-19 06:28:50 +01:00
|
|
|
|
2015-05-10 13:12:31 +02:00
|
|
|
var btnResetEl = tf.Cpt.clearButton.btnResetEl;
|
|
|
|
deepEqual(btnResetEl.nodeName, 'A', 'Clear button tag changed');
|
|
|
|
deepEqual(btnResetEl.innerText, 'Clear', 'Clear button text');
|
2015-02-19 06:28:50 +01:00
|
|
|
});
|
2015-05-10 13:12:31 +02:00
|
|
|
|