1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-17 05:46:39 +02:00
TableFilter/test/test-dropdown.js

31 lines
933 B
JavaScript
Raw Normal View History

2015-02-15 05:04:57 +01:00
2015-05-10 13:12:31 +02:00
var id = function (id){ return document.getElementById(id); };
var tf = new TableFilter('demo', {
base_path: '../dist/tablefilter/',
2015-05-10 13:12:31 +02:00
col_2: 'multiple',
col_3: 'select',
fill_slc_on_demand: false
});
tf.init();
2015-02-15 05:04:57 +01:00
2015-05-10 13:12:31 +02:00
var dropdown = tf.Cpt.dropdown;
module('Sanity checks');
test('Drop-down component', function() {
deepEqual(typeof dropdown, 'object', 'DropDown instanciated');
deepEqual(dropdown.opts instanceof Array, true, 'Type of opts property');
});
2015-02-15 05:04:57 +01:00
2015-05-10 13:12:31 +02:00
module('UI elements');
test('Drop-down UI elements', function() {
var flt1 = id(tf.fltIds[3]);
var flt2 = id(tf.fltIds[2]);
notEqual(flt1, null, 'DropDown SELECT element exists');
notEqual(flt2, null, 'DropDown SELECT element exists');
deepEqual(flt2.hasAttribute('multiple'), true, 'Multiple select exists');
});
2015-02-15 05:04:57 +01:00
2015-05-10 13:12:31 +02:00
test('TableFilter removed', function() {
tf.remove();
deepEqual(id(tf.fltIds[3]), null, 'Filter is removed');
2015-02-15 05:04:57 +01:00
});