1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "sPaginationType" );
4 $(document).ready( function () {
5 /* Check the default */
6 var oTable = $('#example').dataTable( {
7 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
10 var oSettings = oTable.fnSettings();
13 "Check two button paging is the default",
15 function () { return oSettings.sPaginationType == "two_button"; }
19 "Check class is applied",
21 function () { return $('#example_paginate').hasClass('paging_two_button'); }
25 "Two A elements are in the wrapper",
27 function () { return $('#example_paginate a').length == 2; }
31 "We have the previous button",
33 function () { return document.getElementById('example_previous'); }
37 "We have the next button",
39 function () { return document.getElementById('example_next'); }
43 "Previous button is disabled",
45 function () { return $('#example_previous').hasClass('paginate_disabled_previous'); }
49 "Next button is enabled",
51 function () { return $('#example_next').hasClass('paginate_enabled_next'); }
54 /* Don't test paging - that's done by the zero config test script. */
57 /* Two buttons paging */
58 var bComplete = false;
60 "Can enabled full numbers paging",
63 oTable = $('#example').dataTable( {
64 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
66 "sPaginationType": "full_numbers",
67 "fnInitComplete": function () {
71 oSettings = oTable.fnSettings();
75 return oSettings.sPaginationType == "full_numbers";
82 "Check full numbers class is applied",
84 function () { return $('#example_paginate').hasClass('paging_full_numbers'); }
88 var nFirst, nPrevious, nNext, nLast;
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');
99 return document.getElementById('example_info').innerHTML == "Showing 51 to 57 of 57 entries";
104 "Go to two pages previous",
110 return document.getElementById('example_info').innerHTML == "Showing 31 to 40 of 57 entries";
115 "Next (second last) page",
120 return document.getElementById('example_info').innerHTML == "Showing 41 to 50 of 57 entries";
125 "Jump to first page",
130 return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries";