Skip to content

Commit

Permalink
Merge branch 'master' of github.com:DataTables/DataTablesSrc
Browse files Browse the repository at this point in the history
  • Loading branch information
SandyDatatables committed Jun 19, 2020
2 parents a4cc54f + 572252f commit 4f1dfc8
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
2 changes: 1 addition & 1 deletion js/ext/ext.paging.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ $.extend( true, DataTable.ext.renderer, {
case 'last':
btnDisplay = lang.sLast;

if ( page === pages-1 ) {
if ( pages === 0 || page === pages-1 ) {
tabIndex = -1;
btnClass += ' ' + disabledClass;
}
Expand Down
56 changes: 56 additions & 0 deletions test/options/Options/pagingType.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,62 @@ describe('pageType Option', function() {
});
});

describe('Check the various paging types when empty table', function() {
dt.html('empty');
it('Default', function() {
$('#example').dataTable();
expect($('.paginate_button').length).toBe(2);
});

dt.html('empty');
it('Numbers', function() {
$('#example').dataTable({
pagingType: 'numbers'
});
expect($('.paginate_button').length).toBe(0);
});

dt.html('empty');
it('Simple', function() {
$('#example').dataTable({
pagingType: 'simple'
});
expect($('.paginate_button').length).toBe(2);
});

dt.html('empty');
it('Simple Numbers', function() {
$('#example').dataTable({
pagingType: 'simple_numbers'
});
expect($('.paginate_button').length).toBe(2);
});

dt.html('empty');
it('Full', function() {
$('#example').dataTable({
pagingType: 'full'
});
expect($('.paginate_button').length).toBe(4);
});

dt.html('empty');
it('Full Numbers', function() {
$('#example').dataTable({
pagingType: 'full_numbers'
});
expect($('.paginate_button').length).toBe(4);
});

dt.html('empty');
it('First Last Numbers', function() {
$('#example').dataTable({
pagingType: 'first_last_numbers'
});
expect($('.paginate_button').length).toBe(2);
});
});

describe('General odds and ends', function() {
dt.html('basic');
it('Short page length when mid-table', function() {
Expand Down

0 comments on commit 4f1dfc8

Please sign in to comment.