From 51b6ea9626a1be8304e495b39cd9ed6ca1ce5c0d Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Tue, 9 Jun 2020 11:33:51 +0200 Subject: [PATCH] [test] Speed up slow TablePagination tests (#21374) --- .../src/TablePagination/TablePagination.test.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/material-ui/src/TablePagination/TablePagination.test.js b/packages/material-ui/src/TablePagination/TablePagination.test.js index 61e448c57d44be..ef38fb31a5bd0b 100644 --- a/packages/material-ui/src/TablePagination/TablePagination.test.js +++ b/packages/material-ui/src/TablePagination/TablePagination.test.js @@ -132,7 +132,7 @@ describe('', () => { describe('prop: page', () => { it('should disable the back button on the first page', () => { - const { getByRole } = render( + const { getAllByRole } = render( @@ -147,14 +147,14 @@ describe('', () => {
, ); - const backButton = getByRole('button', { name: 'Previous page' }); - const nextButton = getByRole('button', { name: 'Next page' }); + + const [, backButton, nextButton] = getAllByRole('button'); expect(backButton).to.have.property('disabled', true); expect(nextButton).to.have.property('disabled', false); }); it('should disable the next button on the last page', () => { - const { getByRole } = render( + const { getAllByRole } = render( @@ -170,8 +170,7 @@ describe('', () => {
, ); - const backButton = getByRole('button', { name: 'Previous page' }); - const nextButton = getByRole('button', { name: 'Next page' }); + const [, backButton, nextButton] = getAllByRole('button'); expect(backButton).to.have.property('disabled', false); expect(nextButton).to.have.property('disabled', true); });