mirror of
https://github.com/koalyptus/TableFilter.git
synced 2026-03-18 08:29:50 +01:00
Added tests for dropdown change event
This commit is contained in:
parent
fe2e06e637
commit
fbd8fa52d2
12 changed files with 10275 additions and 43 deletions
|
|
@ -22,8 +22,21 @@ test('CheckList UI elements', function() {
|
|||
deepEqual(flt.childNodes.length, 8, 'number of checklist options');
|
||||
});
|
||||
|
||||
module('Behaviour');
|
||||
test('Can filter on checkList change', function() {
|
||||
var flt1 = id(tf.fltIds[3]);
|
||||
|
||||
var evObj = document.createEvent('HTMLEvents');
|
||||
evObj.initEvent('change', true, true);
|
||||
tf.activeFlt = flt1;
|
||||
tf.setFilterValue(3, '1.1');
|
||||
flt1.dispatchEvent(evObj);
|
||||
|
||||
deepEqual(tf.getValidRows().length, 1, 'Table filtered');
|
||||
deepEqual(tf.getFilteredData()[0][1][3], '1.1', 'Matched value');
|
||||
});
|
||||
|
||||
test('TableFilter removed', function() {
|
||||
tf.destroy();
|
||||
deepEqual(id(tf.fltIds[3]), null, 'CheckList UL element');
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,20 @@ test('Drop-down UI elements', function() {
|
|||
deepEqual(flt2.hasAttribute('multiple'), true, 'Multiple select exists');
|
||||
});
|
||||
|
||||
module('Behaviour');
|
||||
test('Can filter on drop-down change', function() {
|
||||
var flt1 = id(tf.fltIds[3]);
|
||||
|
||||
var evObj = document.createEvent('HTMLEvents');
|
||||
evObj.initEvent('change', true, true);
|
||||
tf.activeFlt = flt1;
|
||||
tf.setFilterValue(3, '1.1');
|
||||
flt1.dispatchEvent(evObj);
|
||||
|
||||
deepEqual(tf.getValidRows().length, 1, 'Table filtered');
|
||||
deepEqual(tf.getFilteredData()[0][1][3], '1.1', 'Matched value');
|
||||
});
|
||||
|
||||
test('TableFilter removed', function() {
|
||||
tf.destroy();
|
||||
deepEqual(id(tf.fltIds[3]), null, 'Filter is removed');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue