| 1 |
// DATA_TEMPLATE: html_table |
| 2 |
oTest.fnStart( "Check type is correctly applied to filtering columns" ); |
| 3 |
|
| 4 |
|
| 5 |
$(document).ready( function () { |
| 6 |
// The second column is HTML type, and should be detected as such, while the first |
| 7 |
// column is number type. We should get no results, as a test for the bug, when |
| 8 |
// searching for http |
| 9 |
$('#example').dataTable( { |
| 10 |
columnDefs: [ |
| 11 |
{ |
| 12 |
targets: [ 0 ], |
| 13 |
searchable: false |
| 14 |
} |
| 15 |
] |
| 16 |
} ); |
| 17 |
|
| 18 |
oTest.fnTest( |
| 19 |
"Check html is stripped from second column", |
| 20 |
function () { $('#example').dataTable().fnFilter('http'); }, |
| 21 |
function () { return $('div.dataTables_info').html() == |
| 22 |
'Showing 0 to 0 of 0 entries (filtered from 4 total entries)'; |
| 23 |
} |
| 24 |
); |
| 25 |
|
| 26 |
oTest.fnTest( |
| 27 |
"But can filter on text in links", |
| 28 |
function () { $('#example').dataTable().fnFilter('Integrity'); }, |
| 29 |
function () { return $('div.dataTables_info').html() == |
| 30 |
'Showing 1 to 3 of 3 entries (filtered from 4 total entries)'; |
| 31 |
} |
| 32 |
); |
| 33 |
|
| 34 |
oTest.fnTest( |
| 35 |
"And on non-link text", |
| 36 |
function () { $('#example').dataTable().fnFilter('EInt'); }, |
| 37 |
function () { return $('div.dataTables_info').html() == |
| 38 |
'Showing 1 to 1 of 1 entries (filtered from 4 total entries)'; |
| 39 |
} |
| 40 |
); |
| 41 |
|
| 42 |
oTest.fnTest( |
| 43 |
"No search results on non-serachable data (first column)", |
| 44 |
function () { $('#example').dataTable().fnFilter('2'); }, |
| 45 |
function () { return $('div.dataTables_info').html() == |
| 46 |
'Showing 0 to 0 of 0 entries (filtered from 4 total entries)'; |
| 47 |
} |
| 48 |
); |
| 49 |
|
| 50 |
oTest.fnTest( |
| 51 |
"Release search", |
| 52 |
function () { $('#example').dataTable().fnFilter(''); }, |
| 53 |
function () { return $('div.dataTables_info').html() == |
| 54 |
'Showing 1 to 4 of 4 entries'; |
| 55 |
} |
| 56 |
); |
| 57 |
|
| 58 |
|
| 59 |
oTest.fnComplete(); |
| 60 |
} ); |