From b910758a53e563b06453923d1a68d7c772603de2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Naskr=C4=99ski?= <36169811+kleyu@users.noreply.github.com> Date: Tue, 30 Apr 2019 02:48:04 +0200 Subject: [PATCH] fix(Pagination): pageInputDisabled won't disable buttons (#2264) (#2278) --- src/components/Pagination/Pagination-test.js | 23 ++++++++++++++++++++ src/components/Pagination/Pagination.js | 6 ++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/components/Pagination/Pagination-test.js b/src/components/Pagination/Pagination-test.js index d5c44c7942..ac57c387ca 100644 --- a/src/components/Pagination/Pagination-test.js +++ b/src/components/Pagination/Pagination-test.js @@ -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( + + ); + 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', () => { diff --git a/src/components/Pagination/Pagination.js b/src/components/Pagination/Pagination.js index 2f5da275df..25ff10aa93 100644 --- a/src/components/Pagination/Pagination.js +++ b/src/components/Pagination/Pagination.js @@ -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 = @@ -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);