Skip to content
This repository has been archived by the owner on Oct 19, 2021. It is now read-only.

Commit

Permalink
fix(Pagination): pageInputDisabled won't disable buttons (#2264) (#2278)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaknas authored and asudoh committed Apr 30, 2019
1 parent 3e9862c commit b910758
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
23 changes: 23 additions & 0 deletions src/components/Pagination/Pagination-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,29 @@ describe('Pagination', () => {
);
expect(right.length).toEqual(0);
});

it('should not append `pagination__button--no-index` class if input is disabled', () => {
const pagination = shallow(
<Pagination
page={2}
pageSizes={[100]}
pagesUnknown={true}
pageInputDisabled={true}
/>
);
const forwardButton = pagination.find(
'.bx--pagination__button--forward'
);
const backwardButton = pagination.find(
'.bx--pagination__button--backward'
);
expect(
backwardButton.hasClass('bx--pagination__button--no-index')
).toEqual(false);
expect(
forwardButton.hasClass('bx--pagination__button--no-index')
).toEqual(false);
});
});

describe('pagination navigation', () => {
Expand Down
6 changes: 2 additions & 4 deletions src/components/Pagination/Pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,7 @@ export default class Pagination extends Component {
`${prefix}--pagination__button`,
`${prefix}--pagination__button--backward`,
{
[`${prefix}--pagination__button--no-index`]:
pageInputDisabled || backButtonDisabled,
[`${prefix}--pagination__button--no-index`]: backButtonDisabled,
}
);
const forwardButtonDisabled =
Expand All @@ -270,8 +269,7 @@ export default class Pagination extends Component {
`${prefix}--pagination__button`,
`${prefix}--pagination__button--forward`,
{
[`${prefix}--pagination__button--no-index`]:
pageInputDisabled || forwardButtonDisabled,
[`${prefix}--pagination__button--no-index`]: forwardButtonDisabled,
}
);
const selectItems = this.renderSelectItems(totalPages);
Expand Down

0 comments on commit b910758

Please sign in to comment.