2015-02-20 05:03:57 +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
|
|
|
help_instructions: true
|
|
|
|
});
|
|
|
|
tf.init();
|
2015-02-20 05:03:57 +01:00
|
|
|
|
2015-06-07 17:31:15 +02:00
|
|
|
var help = tf.feature('help');
|
2015-05-10 13:12:31 +02:00
|
|
|
module('Sanity checks');
|
|
|
|
test('Clear button component', function() {
|
|
|
|
deepEqual(typeof help, 'object', 'Help instanciated');
|
2015-06-08 12:21:50 +02:00
|
|
|
notEqual(help.btn, null, 'btn property');
|
2015-05-10 13:12:31 +02:00
|
|
|
});
|
2015-02-20 05:03:57 +01:00
|
|
|
|
2015-05-10 13:12:31 +02:00
|
|
|
module('UI elements');
|
|
|
|
test('Help UI elements', function() {
|
2015-06-08 12:21:50 +02:00
|
|
|
var container = help.cont,
|
|
|
|
helpBtn = help.btn;
|
2015-05-10 13:12:31 +02:00
|
|
|
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();
|
2015-06-08 12:21:50 +02:00
|
|
|
var container = help.cont,
|
|
|
|
helpBtn = help.btn;
|
2015-05-10 13:12:31 +02:00
|
|
|
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() {
|
2015-06-07 17:31:15 +02:00
|
|
|
var help = tf.feature('help');
|
|
|
|
help.destroy();
|
2015-06-08 12:21:50 +02:00
|
|
|
help.btnText = '→Help←';
|
|
|
|
help.instrText = 'Hello world!';
|
2015-06-07 17:31:15 +02:00
|
|
|
help.init();
|
2015-05-10 13:12:31 +02:00
|
|
|
|
2015-06-08 12:21:50 +02:00
|
|
|
var container = help.cont,
|
|
|
|
helpBtn = help.btn;
|
2015-05-10 13:12:31 +02:00
|
|
|
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
|
|
|
});
|