1 |
// DATA_TEMPLATE: empty_table |
2 |
oTest.fnStart( "oLanguage.sInfoEmpty" ); |
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 |
"Info empty language is 'Showing 0 to 0 of 0 entries' by default", |
14 |
function () { oTable.fnFilter("nothinghere"); }, |
15 |
function () { return oSettings.oLanguage.sInfoEmpty == "Showing 0 to 0 of 0 entries"; } |
16 |
); |
17 |
|
18 |
oTest.fnTest( |
19 |
"Info empty language default is in the DOM", |
20 |
null, |
21 |
function () { |
22 |
var bReturn = document.getElementById('example_info').innerHTML.replace( |
23 |
' '+oSettings.oLanguage.sInfoFiltered.replace( '_MAX_', '57' ), "" ) == |
24 |
"Showing 0 to 0 of 0 entries"; |
25 |
return bReturn; |
26 |
} |
27 |
); |
28 |
|
29 |
|
30 |
oTest.fnWaitTest( |
31 |
"Info empty language can be defined", |
32 |
function () { |
33 |
oSession.fnRestore(); |
34 |
oTable = $('#example').dataTable( { |
35 |
"sAjaxSource": "../../../examples/ajax/sources/arrays.txt", |
36 |
"bDeferRender": true, |
37 |
"oLanguage": { |
38 |
"sInfoEmpty": "unit test" |
39 |
} |
40 |
} ); |
41 |
oSettings = oTable.fnSettings(); |
42 |
oTable.fnFilter("nothinghere"); |
43 |
}, |
44 |
function () { return oSettings.oLanguage.sInfoEmpty == "unit test"; } |
45 |
); |
46 |
|
47 |
oTest.fnTest( |
48 |
"Info empty language default is in the DOM", |
49 |
null, |
50 |
function () { |
51 |
var bReturn = document.getElementById('example_info').innerHTML.replace( |
52 |
' '+oSettings.oLanguage.sInfoFiltered.replace( '_MAX_', '57' ), "" ) == |
53 |
"unit test"; |
54 |
return bReturn; |
55 |
} |
56 |
); |
57 |
|
58 |
|
59 |
oTest.fnWaitTest( |
60 |
"Macro's replaced", |
61 |
function () { |
62 |
oSession.fnRestore(); |
63 |
oTable = $('#example').dataTable( { |
64 |
"sAjaxSource": "../../../examples/ajax/sources/arrays.txt", |
65 |
"bDeferRender": true, |
66 |
"oLanguage": { |
67 |
"sInfoEmpty": "unit _START_ _END_ _TOTAL_ test" |
68 |
} |
69 |
} ); |
70 |
oTable.fnFilter("nothinghere"); |
71 |
}, |
72 |
function () { |
73 |
var bReturn = document.getElementById('example_info').innerHTML.replace( |
74 |
' '+oSettings.oLanguage.sInfoFiltered.replace( '_MAX_', '57' ), "" ) == |
75 |
"unit 1 0 0 test"; |
76 |
return bReturn; |
77 |
} |
78 |
); |
79 |
|
80 |
|
81 |
oTest.fnComplete(); |
82 |
} ); |