1 |
// DATA_TEMPLATE: dom_data |
2 |
oTest.fnStart( "iDisplayLength" ); |
3 |
|
4 |
$(document).ready( function () { |
5 |
/* Check the default */ |
6 |
$('#example').dataTable(); |
7 |
|
8 |
oTest.fnTest( |
9 |
"Default length is ten", |
10 |
null, |
11 |
function () { return $('#example tbody tr').length == 10; } |
12 |
); |
13 |
|
14 |
oTest.fnTest( |
15 |
"Select menu shows 10", |
16 |
null, |
17 |
function () { return $('#example_length select').val() == 10; } |
18 |
); |
19 |
|
20 |
|
21 |
oTest.fnTest( |
22 |
"Set initial length to 25", |
23 |
function () { |
24 |
oSession.fnRestore(); |
25 |
$('#example').dataTable( { |
26 |
"iDisplayLength": 25 |
27 |
} ); |
28 |
}, |
29 |
function () { return $('#example tbody tr').length == 25; } |
30 |
); |
31 |
|
32 |
oTest.fnTest( |
33 |
"Select menu shows 25", |
34 |
null, |
35 |
function () { return $('#example_length select').val() == 25; } |
36 |
); |
37 |
|
38 |
|
39 |
oTest.fnTest( |
40 |
"Set initial length to 100", |
41 |
function () { |
42 |
oSession.fnRestore(); |
43 |
$('#example').dataTable( { |
44 |
"iDisplayLength": 100 |
45 |
} ); |
46 |
}, |
47 |
function () { return $('#example tbody tr').length == 57; } |
48 |
); |
49 |
|
50 |
oTest.fnTest( |
51 |
"Select menu shows 25", |
52 |
null, |
53 |
function () { return $('#example_length select').val() == 100; } |
54 |
); |
55 |
|
56 |
|
57 |
oTest.fnTest( |
58 |
"Set initial length to 23 (unknown select menu length)", |
59 |
function () { |
60 |
oSession.fnRestore(); |
61 |
$('#example').dataTable( { |
62 |
"iDisplayLength": 23 |
63 |
} ); |
64 |
}, |
65 |
function () { return $('#example tbody tr').length == 23; } |
66 |
); |
67 |
|
68 |
oTest.fnTest( |
69 |
"Select menu shows 10 (since 23 is unknow)", |
70 |
null, |
71 |
function () { return $('#example_length select').val() == 10; } |
72 |
); |
73 |
|
74 |
|
75 |
oTest.fnComplete(); |
76 |
} ); |