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"
9 var oSettings = oTable.fnSettings();
12 "Check two button paging is the default",
14 function () { return oSettings.sPaginationType == "two_button"; }
18 "Check class is applied",
20 function () { return $('#example_paginate').hasClass('paging_two_button'); }
24 "Two A elements are in the wrapper",
26 function () { return $('#example_paginate a').length == 2; }
30 "We have the previous button",
32 function () { return document.getElementById('example_previous'); }
36 "We have the next button",
38 function () { return document.getElementById('example_next'); }
42 "Previous button is disabled",
44 function () { return $('#example_previous').hasClass('paginate_disabled_previous'); }
48 "Next button is enabled",
50 function () { return $('#example_next').hasClass('paginate_enabled_next'); }
53 /* Don't test paging - that's done by the zero config test script. */
56 /* Two buttons paging */
57 var bComplete = false;
59 "Can enabled full numbers paging",
62 oTable = $('#example').dataTable( {
63 "sAjaxSource": "../../../examples/ajax/sources/arrays.txt",
64 "sPaginationType": "full_numbers",
65 "fnInitComplete": function () {
69 oSettings = oTable.fnSettings();
73 return oSettings.sPaginationType == "full_numbers";
80 "Check full numbers class is applied",
82 function () { return $('#example_paginate').hasClass('paging_full_numbers'); }
86 var nFirst, nPrevious, nNext, nLast;
90 nFirst = $('div.dataTables_paginate a.first');
91 nPrevious = $('div.dataTables_paginate a.previous');
92 nNext = $('div.dataTables_paginate a.next');
93 nLast = $('div.dataTables_paginate a.last');
97 return document.getElementById('example_info').innerHTML == "Showing 51 to 57 of 57 entries";
102 "Go to two pages previous",
108 return document.getElementById('example_info').innerHTML == "Showing 31 to 40 of 57 entries";
113 "Next (second last) page",
118 return document.getElementById('example_info').innerHTML == "Showing 41 to 50 of 57 entries";
123 "Jump to first page",
128 return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries";