2014-12-14 05:55:01 +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
|
|
|
highlight_keywords: true
|
|
|
|
});
|
|
|
|
tf.init();
|
2014-12-14 05:55:01 +01:00
|
|
|
|
2015-05-10 13:12:31 +02:00
|
|
|
var highlightKeyword = tf.Cpt.highlightKeyword;
|
|
|
|
module('Sanity checks');
|
|
|
|
test('HighlightKeyword component', function() {
|
|
|
|
deepEqual(typeof highlightKeyword, 'object', 'Instanciated');
|
|
|
|
deepEqual(highlightKeyword.highlightedNodes instanceof Array, true, 'Property check');
|
|
|
|
});
|
2014-12-14 05:55:01 +01:00
|
|
|
|
2015-05-10 13:12:31 +02:00
|
|
|
test('Highlighted keywords', function() {
|
|
|
|
tf.setFilterValue(1, 'Perth');
|
|
|
|
tf.setFilterValue(3, '3.1');
|
|
|
|
tf._filter();
|
|
|
|
deepEqual(highlightKeyword.highlightedNodes.length, 2, 'Number of highlighted words');
|
2014-12-14 05:55:01 +01:00
|
|
|
|
2015-05-10 13:12:31 +02:00
|
|
|
tf._clearFilters();
|
|
|
|
tf._filter();
|
|
|
|
deepEqual(highlightKeyword.highlightedNodes.length, 0, 'Number of highlighted words');
|
|
|
|
});
|