1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-17 22:06:41 +02:00
TableFilter/test/test-clear-button.js

40 lines
1.2 KiB
JavaScript
Raw Normal View History

2015-02-19 06:28:50 +01:00
2015-05-10 13:12:31 +02:00
var tf = new TableFilter('demo', {
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