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

46 lines
1.3 KiB
JavaScript
Raw Normal View History

2015-02-20 05:03:57 +01:00
2015-05-10 13:12:31 +02:00
var tf = new TableFilter('demo', {
help_instructions: true
});
tf.init();
2015-02-20 05:03:57 +01:00
2015-05-10 13:12:31 +02:00
var help = tf.Cpt.help;
module('Sanity checks');
test('Clear button component', function() {
deepEqual(typeof help, 'object', 'Help instanciated');
notEqual(help.helpInstrBtnEl, null, 'helpInstrBtnEl property');
});
2015-02-20 05:03:57 +01:00
2015-05-10 13:12:31 +02:00
module('UI elements');
test('Help UI elements', function() {
var container = help.helpInstrContEl,
helpBtn = help.helpInstrBtnEl;
deepEqual(container.nodeName, 'DIV', 'Help container');
deepEqual(helpBtn.nodeName, 'SPAN', 'Help button');
});
2015-02-20 05:03:57 +01:00
2015-05-10 13:12:31 +02:00
module('Destroy and re-init');
test('Remove UI', function() {
help.destroy();
var container = help.helpInstrContEl,
helpBtn = help.helpInstrBtnEl;
deepEqual(container, null, 'Help container removed');
deepEqual(helpBtn, null, 'Help button removed');
});
2015-02-20 05:03:57 +01:00
2015-05-10 13:12:31 +02:00
test('Re-set UI', function() {
tf.Cpt.help.destroy();
tf.Cpt.help.helpInstrBtnText = '→Help←';
tf.Cpt.help.helpInstrText = 'Hello world!';
tf.Cpt.help.init();
var container = help.helpInstrContEl,
helpBtn = help.helpInstrBtnEl;
notEqual(
container.innerHTML.indexOf('Hello world!'),
-1,
'Help pop-up text'
);
notEqual(helpBtn.innerHTML.indexOf('→Help←'), -1, 'Help button text');
2015-02-20 05:03:57 +01:00
});