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