mirror of
https://github.com/koalyptus/TableFilter.git
synced 2026-03-14 22:55:44 +01:00
refine empty-nonempty operator checks
This commit is contained in:
parent
50afb94340
commit
efffa40248
6 changed files with 42 additions and 15 deletions
|
|
@ -51,10 +51,13 @@
|
|||
});
|
||||
|
||||
test('Empty operator - [empty]', function() {
|
||||
var cell = tf.getWorkingRows()[4].cells[4];
|
||||
cell.innerHTML = '';
|
||||
tf.clearFilters();
|
||||
tf.setFilterValue(4, '[empty]');
|
||||
tf.filter();
|
||||
var filteredData = tf.getFilteredData();
|
||||
|
||||
deepEqual(tf.getValidRows().length, 1, 'Expected number of matches');
|
||||
deepEqual(
|
||||
filteredData[0],
|
||||
|
|
@ -63,7 +66,18 @@
|
|||
);
|
||||
});
|
||||
|
||||
test('Empty operator - with cell containing dom element', function() {
|
||||
var cell = tf.getWorkingRows()[4].cells[4];
|
||||
cell.innerHTML = '<img>';
|
||||
tf.clearFilters();
|
||||
tf.setFilterValue(4, '[empty]');
|
||||
tf.filter();
|
||||
deepEqual(tf.getValidRows().length, 0, 'No matches expected');
|
||||
});
|
||||
|
||||
test('Non-empty operator - [nonempty]', function() {
|
||||
var cell = tf.getWorkingRows()[4].cells[4];
|
||||
cell.innerHTML = '';
|
||||
tf.clearFilters();
|
||||
tf.setFilterValue(4, '[nonempty]');
|
||||
tf.filter();
|
||||
|
|
@ -75,6 +89,18 @@
|
|||
'Expected row data');
|
||||
});
|
||||
|
||||
test('Non-empty operator - with cell containing dom element', function() {
|
||||
var cell = tf.getWorkingRows()[4].cells[4];
|
||||
cell.innerHTML = '<img>';
|
||||
tf.clearFilters();
|
||||
tf.setFilterValue(4, '[nonempty]');
|
||||
tf.filter();
|
||||
var filteredData = tf.getFilteredData();
|
||||
console.log(filteredData);
|
||||
|
||||
deepEqual(tf.getValidRows().length, 7, 'Expected number of matches');
|
||||
});
|
||||
|
||||
test('Or operator - ||', function() {
|
||||
tf.clearFilters();
|
||||
tf.setFilterValue(1, 'Canberra||Alice Springs');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue