| 1 |
// DATA_TEMPLATE: empty_table |
| 2 |
oTest.fnStart( "bLengthChange" ); |
| 3 |
|
| 4 |
$(document).ready( function () { |
| 5 |
/* Check the default */ |
| 6 |
$('#example').dataTable( { |
| 7 |
"sAjaxSource": "../../../examples/ajax/sources/arrays.txt", |
| 8 |
"bDeferRender": true |
| 9 |
} ); |
| 10 |
|
| 11 |
oTest.fnWaitTest( |
| 12 |
"Length div exists by default", |
| 13 |
null, |
| 14 |
function () { return document.getElementById('example_length') != null; } |
| 15 |
); |
| 16 |
|
| 17 |
oTest.fnWaitTest( |
| 18 |
"Four default options", |
| 19 |
null, |
| 20 |
function () { return $("select[name=example_length] option").length == 4; } |
| 21 |
); |
| 22 |
|
| 23 |
oTest.fnWaitTest( |
| 24 |
"Default options", |
| 25 |
null, |
| 26 |
function () { |
| 27 |
var opts = $("select[name='example_length'] option"); |
| 28 |
return opts[0].getAttribute('value') == 10 && opts[1].getAttribute('value') == 25 && |
| 29 |
opts[2].getAttribute('value') == 50 && opts[3].getAttribute('value') == 100; |
| 30 |
} |
| 31 |
); |
| 32 |
|
| 33 |
oTest.fnWaitTest( |
| 34 |
"Info takes length into account", |
| 35 |
null, |
| 36 |
function () { return document.getElementById('example_info').innerHTML == |
| 37 |
"Showing 1 to 10 of 57 entries"; } |
| 38 |
); |
| 39 |
|
| 40 |
/* Check can disable */ |
| 41 |
oTest.fnWaitTest( |
| 42 |
"Change length can be disabled", |
| 43 |
function () { |
| 44 |
oSession.fnRestore(); |
| 45 |
$('#example').dataTable( { |
| 46 |
"sAjaxSource": "../../../examples/ajax/sources/arrays.txt", |
| 47 |
"bDeferRender": true, |
| 48 |
"bLengthChange": false |
| 49 |
} ); |
| 50 |
}, |
| 51 |
function () { return document.getElementById('example_length') == null; } |
| 52 |
); |
| 53 |
|
| 54 |
oTest.fnWaitTest( |
| 55 |
"Information takes length disabled into account", |
| 56 |
null, |
| 57 |
function () { return document.getElementById('example_info').innerHTML == |
| 58 |
"Showing 1 to 10 of 57 entries"; } |
| 59 |
); |
| 60 |
|
| 61 |
/* Enable makes no difference */ |
| 62 |
oTest.fnWaitTest( |
| 63 |
"Length change enabled override", |
| 64 |
function () { |
| 65 |
oSession.fnRestore(); |
| 66 |
$('#example').dataTable( { |
| 67 |
"sAjaxSource": "../../../examples/ajax/sources/arrays.txt", |
| 68 |
"bDeferRender": true, |
| 69 |
"bLengthChange": true |
| 70 |
} ); |
| 71 |
}, |
| 72 |
function () { return document.getElementById('example_length') != null; } |
| 73 |
); |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
oTest.fnComplete(); |
| 78 |
} ); |