Fix Cancel button behavior on TopFilterAndSort bar (#106)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { fireEvent, render } from '@testing-library/react';
|
||||
import { fireEvent, render, waitFor } from '@testing-library/react';
|
||||
|
||||
import { EditableDateStory } from '../__stories__/EditableDate.stories';
|
||||
import { act } from 'react-dom/test-utils';
|
||||
@@ -19,19 +19,18 @@ it('Checks the EditableDate editing event bubbles up', async () => {
|
||||
if (!wrapper) {
|
||||
throw new Error('Cell Wrapper not found');
|
||||
}
|
||||
|
||||
act(() => {
|
||||
fireEvent.click(wrapper);
|
||||
const dateDisplay = parent.querySelector('div');
|
||||
if (!dateDisplay) {
|
||||
throw new Error('Editable input not found');
|
||||
}
|
||||
});
|
||||
waitFor(() => {
|
||||
expect(getByText('March 2021')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
const dateDisplay = parent.querySelector('div');
|
||||
|
||||
if (!dateDisplay) {
|
||||
throw new Error('Editable input not found');
|
||||
}
|
||||
|
||||
expect(getByText('March 2021')).toBeInTheDocument();
|
||||
act(() => {
|
||||
fireEvent.click(getByText('5'));
|
||||
});
|
||||
fireEvent.click(getByText('5'));
|
||||
expect(changeHandler).toHaveBeenCalledWith(new Date('2021-03-05'));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user