| 1 |
// DATA_TEMPLATE: empty_table |
| 2 |
oTest.fnStart( "oLanguage.sSearch" ); |
| 3 |
|
| 4 |
$(document).ready( function () { |
| 5 |
/* Check the default */ |
| 6 |
var oTable = $('#example').dataTable( { |
| 7 |
"sAjaxSource": "../../../examples/ajax/sources/arrays.txt" |
| 8 |
} ); |
| 9 |
var oSettings = oTable.fnSettings(); |
| 10 |
|
| 11 |
oTest.fnWaitTest( |
| 12 |
"Search language is 'Search:' by default", |
| 13 |
null, |
| 14 |
function () { return oSettings.oLanguage.sSearch == "Search:"; } |
| 15 |
); |
| 16 |
|
| 17 |
oTest.fnTest( |
| 18 |
"A label input is used", |
| 19 |
null, |
| 20 |
function () { return $('label', oSettings.aanFeatures.f[0]).length == 1 } |
| 21 |
); |
| 22 |
|
| 23 |
oTest.fnTest( |
| 24 |
"Search language default is in the DOM", |
| 25 |
null, |
| 26 |
function () { return $('label', oSettings.aanFeatures.f[0]).text() |
| 27 |
== "Search: "; } |
| 28 |
); |
| 29 |
|
| 30 |
|
| 31 |
oTest.fnWaitTest( |
| 32 |
"Search language can be defined", |
| 33 |
function () { |
| 34 |
oSession.fnRestore(); |
| 35 |
oTable = $('#example').dataTable( { |
| 36 |
"sAjaxSource": "../../../examples/ajax/sources/arrays.txt", |
| 37 |
"oLanguage": { |
| 38 |
"sSearch": "unit test" |
| 39 |
} |
| 40 |
} ); |
| 41 |
oSettings = oTable.fnSettings(); |
| 42 |
}, |
| 43 |
function () { return oSettings.oLanguage.sSearch == "unit test"; } |
| 44 |
); |
| 45 |
|
| 46 |
oTest.fnTest( |
| 47 |
"Info language definition is in the DOM", |
| 48 |
null, |
| 49 |
function () { return $('label', oSettings.aanFeatures.f[0]).text().indexOf('unit test') !== -1; } |
| 50 |
); |
| 51 |
|
| 52 |
|
| 53 |
oTest.fnWaitTest( |
| 54 |
"Blank search has a no space (separator) inserted", |
| 55 |
function () { |
| 56 |
oSession.fnRestore(); |
| 57 |
oTable = $('#example').dataTable( { |
| 58 |
"sAjaxSource": "../../../examples/ajax/sources/arrays.txt", |
| 59 |
"oLanguage": { |
| 60 |
"sSearch": "" |
| 61 |
} |
| 62 |
} ); |
| 63 |
oSettings = oTable.fnSettings(); |
| 64 |
}, |
| 65 |
function () { return document.getElementById('example_filter').childNodes.length == 1; } |
| 66 |
); |
| 67 |
|
| 68 |
|
| 69 |
oTest.fnComplete(); |
| 70 |
} ); |