From 3dd89cf7f4f34f3334d0dd61ed5956acd4835518 Mon Sep 17 00:00:00 2001 From: eps1lon Date: Wed, 28 Apr 2021 13:46:03 +0200 Subject: [PATCH] Fix tests --- .../DesktopDateRangePicker.test.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/material-ui-lab/src/DesktopDateRangePicker/DesktopDateRangePicker.test.tsx b/packages/material-ui-lab/src/DesktopDateRangePicker/DesktopDateRangePicker.test.tsx index 875acdbf3dc80a..9a96b95244fc12 100644 --- a/packages/material-ui-lab/src/DesktopDateRangePicker/DesktopDateRangePicker.test.tsx +++ b/packages/material-ui-lab/src/DesktopDateRangePicker/DesktopDateRangePicker.test.tsx @@ -176,7 +176,7 @@ describe('', () => { expect(getAllByMuiTest('DateRangeHighlight')).to.have.length(31); }); - it('selects the range from the next month', () => { + it('selects the range from the next month', function test() { const onChangeMock = spy(); render( ', () => { ); fireEvent.click(screen.getByLabelText('Jan 1, 2019')); - fireEvent.click( - screen.getByLabelText('Next month', { selector: ':not([aria-hidden="true"])' }), - ); + // FIXME use `getByRole(role, {hidden: false})` and skip JSDOM once this suite can run in JSDOM + const [visibleButton] = screen.getAllByRole('button', { + hidden: true, + name: 'Next month', + }); + fireEvent.click(visibleButton); fireEvent.click(screen.getByLabelText('Mar 19, 2019')); expect(onChangeMock.callCount).to.equal(2);