| 1 |
// DATA_TEMPLATE: js_data |
| 2 |
oTest.fnStart( "oLanguage.sInfo" ); |
| 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 |
"Info language is 'Showing _START_ to _END_ of _TOTAL_ entries' by default", |
| 13 |
null, |
| 14 |
function () { return oSettings.oLanguage.sInfo == "Showing _START_ to _END_ of _TOTAL_ entries"; } |
| 15 |
); |
| 16 |
|
| 17 |
oTest.fnTest( |
| 18 |
"Info language default is in the DOM", |
| 19 |
null, |
| 20 |
function () { return document.getElementById('example_info').innerHTML = "Showing 1 to 10 of 57 entries"; } |
| 21 |
); |
| 22 |
|
| 23 |
|
| 24 |
oTest.fnTest( |
| 25 |
"Info language can be defined - without any macros", |
| 26 |
function () { |
| 27 |
oSession.fnRestore(); |
| 28 |
oTable = $('#example').dataTable( { |
| 29 |
"aaData": gaaData, |
| 30 |
"oLanguage": { |
| 31 |
"sInfo": "unit test" |
| 32 |
} |
| 33 |
} ); |
| 34 |
oSettings = oTable.fnSettings(); |
| 35 |
}, |
| 36 |
function () { return oSettings.oLanguage.sInfo == "unit test"; } |
| 37 |
); |
| 38 |
|
| 39 |
oTest.fnTest( |
| 40 |
"Info language definition is in the DOM", |
| 41 |
null, |
| 42 |
function () { return document.getElementById('example_info').innerHTML = "unit test"; } |
| 43 |
); |
| 44 |
|
| 45 |
oTest.fnTest( |
| 46 |
"Info language can be defined - with macro _START_ only", |
| 47 |
function () { |
| 48 |
oSession.fnRestore(); |
| 49 |
$('#example').dataTable( { |
| 50 |
"aaData": gaaData, |
| 51 |
"oLanguage": { |
| 52 |
"sInfo": "unit _START_ test" |
| 53 |
} |
| 54 |
} ); |
| 55 |
}, |
| 56 |
function () { return document.getElementById('example_info').innerHTML = "unit 1 test"; } |
| 57 |
); |
| 58 |
|
| 59 |
oTest.fnTest( |
| 60 |
"Info language can be defined - with macro _END_ only", |
| 61 |
function () { |
| 62 |
oSession.fnRestore(); |
| 63 |
$('#example').dataTable( { |
| 64 |
"aaData": gaaData, |
| 65 |
"oLanguage": { |
| 66 |
"sInfo": "unit _END_ test" |
| 67 |
} |
| 68 |
} ); |
| 69 |
}, |
| 70 |
function () { return document.getElementById('example_info').innerHTML = "unit 10 test"; } |
| 71 |
); |
| 72 |
|
| 73 |
oTest.fnTest( |
| 74 |
"Info language can be defined - with macro _TOTAL_ only", |
| 75 |
function () { |
| 76 |
oSession.fnRestore(); |
| 77 |
$('#example').dataTable( { |
| 78 |
"aaData": gaaData, |
| 79 |
"oLanguage": { |
| 80 |
"sInfo": "unit _END_ test" |
| 81 |
} |
| 82 |
} ); |
| 83 |
}, |
| 84 |
function () { return document.getElementById('example_info').innerHTML = "unit 57 test"; } |
| 85 |
); |
| 86 |
|
| 87 |
oTest.fnTest( |
| 88 |
"Info language can be defined - with macros _START_ and _END_", |
| 89 |
function () { |
| 90 |
oSession.fnRestore(); |
| 91 |
$('#example').dataTable( { |
| 92 |
"aaData": gaaData, |
| 93 |
"oLanguage": { |
| 94 |
"sInfo": "unit _START_ _END_ test" |
| 95 |
} |
| 96 |
} ); |
| 97 |
}, |
| 98 |
function () { return document.getElementById('example_info').innerHTML = "unit 1 10 test"; } |
| 99 |
); |
| 100 |
|
| 101 |
oTest.fnTest( |
| 102 |
"Info language can be defined - with macros _START_, _END_ and _TOTAL_", |
| 103 |
function () { |
| 104 |
oSession.fnRestore(); |
| 105 |
$('#example').dataTable( { |
| 106 |
"aaData": gaaData, |
| 107 |
"oLanguage": { |
| 108 |
"sInfo": "unit _START_ _END_ _TOTAL_ test" |
| 109 |
} |
| 110 |
} ); |
| 111 |
}, |
| 112 |
function () { return document.getElementById('example_info').innerHTML = "unit 1 10 57 test"; } |
| 113 |
); |
| 114 |
|
| 115 |
|
| 116 |
oTest.fnComplete(); |
| 117 |
} ); |