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