1 |
// DATA_TEMPLATE: js_data |
2 |
oTest.fnStart( "oLanguage.sSearch" ); |
3 |
|
4 |
$(document).ready( function () { |
5 |
/* Check the default */ |
6 |
var oTable = $('#example').dataTable( { |
7 |
"aaData": gaaData |
8 |
} ); |
9 |
var oSettings = oTable.fnSettings(); |
10 |
|
11 |
oTest.fnTest( |
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.fnTest( |
32 |
"Search language can be defined", |
33 |
function () { |
34 |
oSession.fnRestore(); |
35 |
oTable = $('#example').dataTable( { |
36 |
"aaData": gaaData, |
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.fnTest( |
54 |
"Blank search has a no (separator) inserted", |
55 |
function () { |
56 |
oSession.fnRestore(); |
57 |
oTable = $('#example').dataTable( { |
58 |
"aaData": gaaData, |
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 |
} ); |