0
|
1 // DATA_TEMPLATE: empty_table
|
|
2 oTest.fnStart( "sPaginationType" );
|
|
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 "Check two button paging is the default",
|
|
14 null,
|
|
15 function () { return oSettings.sPaginationType == "two_button"; }
|
|
16 );
|
|
17
|
|
18 oTest.fnWaitTest(
|
|
19 "Check class is applied",
|
|
20 null,
|
|
21 function () { return $('#example_paginate').hasClass('paging_two_button'); }
|
|
22 );
|
|
23
|
|
24 oTest.fnWaitTest(
|
|
25 "Two A elements are in the wrapper",
|
|
26 null,
|
|
27 function () { return $('#example_paginate a').length == 2; }
|
|
28 );
|
|
29
|
|
30 oTest.fnWaitTest(
|
|
31 "We have the previous button",
|
|
32 null,
|
|
33 function () { return document.getElementById('example_previous'); }
|
|
34 );
|
|
35
|
|
36 oTest.fnWaitTest(
|
|
37 "We have the next button",
|
|
38 null,
|
|
39 function () { return document.getElementById('example_next'); }
|
|
40 );
|
|
41
|
|
42 oTest.fnWaitTest(
|
|
43 "Previous button is disabled",
|
|
44 null,
|
|
45 function () { return $('#example_previous').hasClass('paginate_disabled_previous'); }
|
|
46 );
|
|
47
|
|
48 oTest.fnWaitTest(
|
|
49 "Next button is enabled",
|
|
50 null,
|
|
51 function () { return $('#example_next').hasClass('paginate_enabled_next'); }
|
|
52 );
|
|
53
|
|
54 /* Don't test paging - that's done by the zero config test script. */
|
|
55
|
|
56
|
|
57 /* Two buttons paging */
|
|
58 var bComplete = false;
|
|
59 oTest.fnWaitTest(
|
|
60 "Can enabled full numbers paging",
|
|
61 function () {
|
|
62 oSession.fnRestore();
|
|
63 oTable = $('#example').dataTable( {
|
|
64 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
|
|
65 "bDeferRender": true,
|
|
66 "sPaginationType": "full_numbers",
|
|
67 "fnInitComplete": function () {
|
|
68 bComplete = true;
|
|
69 }
|
|
70 } );
|
|
71 oSettings = oTable.fnSettings();
|
|
72 },
|
|
73 function () {
|
|
74 if ( bComplete )
|
|
75 return oSettings.sPaginationType == "full_numbers";
|
|
76 else
|
|
77 return false;
|
|
78 }
|
|
79 );
|
|
80
|
|
81 oTest.fnWaitTest(
|
|
82 "Check full numbers class is applied",
|
|
83 null,
|
|
84 function () { return $('#example_paginate').hasClass('paging_full_numbers'); }
|
|
85 );
|
|
86
|
|
87
|
|
88 var nFirst, nPrevious, nNext, nLast;
|
|
89 oTest.fnWaitTest(
|
|
90 "Jump to last page",
|
|
91 function () {
|
|
92 nFirst = $('div.dataTables_paginate a.first');
|
|
93 nPrevious = $('div.dataTables_paginate a.previous');
|
|
94 nNext = $('div.dataTables_paginate a.next');
|
|
95 nLast = $('div.dataTables_paginate a.last');
|
|
96 nLast.click();
|
|
97 },
|
|
98 function () {
|
|
99 return document.getElementById('example_info').innerHTML == "Showing 51 to 57 of 57 entries";
|
|
100 }
|
|
101 );
|
|
102
|
|
103 oTest.fnWaitTest(
|
|
104 "Go to two pages previous",
|
|
105 function () {
|
|
106 nPrevious.click();
|
|
107 nPrevious.click();
|
|
108 },
|
|
109 function () {
|
|
110 return document.getElementById('example_info').innerHTML == "Showing 31 to 40 of 57 entries";
|
|
111 }
|
|
112 );
|
|
113
|
|
114 oTest.fnWaitTest(
|
|
115 "Next (second last) page",
|
|
116 function () {
|
|
117 nNext.click();
|
|
118 },
|
|
119 function () {
|
|
120 return document.getElementById('example_info').innerHTML == "Showing 41 to 50 of 57 entries";
|
|
121 }
|
|
122 );
|
|
123
|
|
124 oTest.fnWaitTest(
|
|
125 "Jump to first page",
|
|
126 function () {
|
|
127 nFirst.click();
|
|
128 },
|
|
129 function () {
|
|
130 return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries";
|
|
131 }
|
|
132 );
|
|
133
|
|
134
|
|
135 oTest.fnComplete();
|
|
136 } ); |