/[projects]/misc/horsensspejder-web/jquery/DataTables-1.9.4/media/unit_testing/tests_onhold/5_ajax_objects/iDisplayLength.js
ViewVC logotype

Contents of /misc/horsensspejder-web/jquery/DataTables-1.9.4/media/unit_testing/tests_onhold/5_ajax_objects/iDisplayLength.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2125 - (show annotations) (download) (as text)
Wed Mar 12 19:30:05 2014 UTC (10 years, 2 months ago) by torben
File MIME type: application/javascript
File size: 2733 byte(s)
initial import
1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "iDisplayLength" );
3
4 $(document).ready( function () {
5 /* Check the default */
6 $('#example').dataTable( {
7 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
8 "aoColumns": [
9 { "mData": "engine" },
10 { "mData": "browser" },
11 { "mData": "platform" },
12 { "mData": "version" },
13 { "mData": "grade" }
14 ]
15 } );
16
17 oTest.fnWaitTest(
18 "Default length is ten",
19 null,
20 function () { return $('#example tbody tr').length == 10; }
21 );
22
23 oTest.fnWaitTest(
24 "Select menu shows 10",
25 null,
26 function () { return $('#example_length select').val() == 10; }
27 );
28
29
30 oTest.fnWaitTest(
31 "Set initial length to 25",
32 function () {
33 oSession.fnRestore();
34 $('#example').dataTable( {
35 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
36 "aoColumnDefs": [
37 { "mData": "engine", "aTargets": [0] },
38 { "mData": "browser", "aTargets": [1] },
39 { "mData": "platform", "aTargets": [2] },
40 { "mData": "version", "aTargets": [3] },
41 { "mData": "grade", "aTargets": [4] }
42 ],
43 "iDisplayLength": 25
44 } );
45 },
46 function () { return $('#example tbody tr').length == 25; }
47 );
48
49 oTest.fnWaitTest(
50 "Select menu shows 25",
51 null,
52 function () { return $('#example_length select').val() == 25; }
53 );
54
55
56 oTest.fnWaitTest(
57 "Set initial length to 100",
58 function () {
59 oSession.fnRestore();
60 $('#example').dataTable( {
61 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
62 "aoColumnDefs": [
63 { "mData": "engine", "aTargets": [0] },
64 { "mData": "browser", "aTargets": [1] },
65 { "mData": "platform", "aTargets": [2] },
66 { "mData": "version", "aTargets": [3] },
67 { "mData": "grade", "aTargets": [4] }
68 ],
69 "iDisplayLength": 100
70 } );
71 },
72 function () { return $('#example tbody tr').length == 57; }
73 );
74
75 oTest.fnWaitTest(
76 "Select menu shows 25",
77 null,
78 function () { return $('#example_length select').val() == 100; }
79 );
80
81
82 oTest.fnWaitTest(
83 "Set initial length to 23 (unknown select menu length)",
84 function () {
85 oSession.fnRestore();
86 $('#example').dataTable( {
87 "sAjaxSource": "../../../examples/ajax/sources/objects.txt",
88 "aoColumnDefs": [
89 { "mData": "engine", "aTargets": [0] },
90 { "mData": "browser", "aTargets": [1] },
91 { "mData": "platform", "aTargets": [2] },
92 { "mData": "version", "aTargets": [3] },
93 { "mData": "grade", "aTargets": [4] }
94 ],
95 "iDisplayLength": 23
96 } );
97 },
98 function () { return $('#example tbody tr').length == 23; }
99 );
100
101 oTest.fnWaitTest(
102 "Select menu shows 10 (since 23 is unknow)",
103 null,
104 function () { return $('#example_length select').val() == 10; }
105 );
106
107
108 oTest.fnComplete();
109 } );

  ViewVC Help
Powered by ViewVC 1.1.20