@@ -68,7 +68,7 @@ describe('SearchModal', () => {
|
||||
);
|
||||
|
||||
expect(query).toHaveBeenCalledTimes(1);
|
||||
userEvent.keyboard('{esc}');
|
||||
await userEvent.keyboard('{Escape}');
|
||||
expect(toggleModal).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
|
||||
@@ -78,19 +78,19 @@ describe('SearchType.Accordion', () => {
|
||||
await act(() => Promise.resolve());
|
||||
});
|
||||
|
||||
it('should set entire types array when a type is selected', () => {
|
||||
it('should set entire types array when a type is selected', async () => {
|
||||
const { getByText } = render(
|
||||
<SearchContext.Provider value={contextSpy}>
|
||||
<SearchType.Accordion name={expectedLabel} types={[expectedType]} />
|
||||
</SearchContext.Provider>,
|
||||
);
|
||||
|
||||
user.click(getByText(expectedType.name));
|
||||
await user.click(getByText(expectedType.name));
|
||||
|
||||
expect(contextSpy.setTypes).toHaveBeenCalledWith([expectedType.value]);
|
||||
});
|
||||
|
||||
it('should reset types array when all is selected', () => {
|
||||
it('should reset types array when all is selected', async () => {
|
||||
const { getByText } = render(
|
||||
<SearchContext.Provider value={contextSpy}>
|
||||
<SearchType.Accordion
|
||||
@@ -101,31 +101,31 @@ describe('SearchType.Accordion', () => {
|
||||
</SearchContext.Provider>,
|
||||
);
|
||||
|
||||
user.click(getByText('All'));
|
||||
await user.click(getByText('All'));
|
||||
|
||||
expect(contextSpy.setTypes).toHaveBeenCalledWith([]);
|
||||
});
|
||||
|
||||
it('should reset page cursor when a new type is selected', () => {
|
||||
it('should reset page cursor when a new type is selected', async () => {
|
||||
const { getByText } = render(
|
||||
<SearchContext.Provider value={contextSpy}>
|
||||
<SearchType.Accordion name={expectedLabel} types={[expectedType]} />
|
||||
</SearchContext.Provider>,
|
||||
);
|
||||
|
||||
user.click(getByText(expectedType.name));
|
||||
await user.click(getByText(expectedType.name));
|
||||
|
||||
expect(contextSpy.setPageCursor).toHaveBeenCalledWith(undefined);
|
||||
});
|
||||
|
||||
it('should collapse when a new type is selected', () => {
|
||||
it('should collapse when a new type is selected', async () => {
|
||||
const { getByText, queryByText } = render(
|
||||
<SearchContext.Provider value={contextSpy}>
|
||||
<SearchType.Accordion name={expectedLabel} types={[expectedType]} />
|
||||
</SearchContext.Provider>,
|
||||
);
|
||||
|
||||
user.click(getByText(expectedType.name));
|
||||
await user.click(getByText(expectedType.name));
|
||||
|
||||
expect(queryByText('Collapse')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
@@ -70,19 +70,19 @@ describe('SearchType.Tabs', () => {
|
||||
await act(() => Promise.resolve());
|
||||
});
|
||||
|
||||
it('should set entire types array when a type is selected', () => {
|
||||
it('should set entire types array when a type is selected', async () => {
|
||||
const { getByText } = render(
|
||||
<SearchContext.Provider value={contextSpy}>
|
||||
<SearchType.Tabs types={[expectedType]} />
|
||||
</SearchContext.Provider>,
|
||||
);
|
||||
|
||||
user.click(getByText(expectedType.name));
|
||||
await user.click(getByText(expectedType.name));
|
||||
|
||||
expect(contextSpy.setTypes).toHaveBeenCalledWith([expectedType.value]);
|
||||
});
|
||||
|
||||
it('should reset types array when all is selected', () => {
|
||||
it('should reset types array when all is selected', async () => {
|
||||
const { getByText } = render(
|
||||
<SearchContext.Provider value={contextSpy}>
|
||||
<SearchType.Tabs
|
||||
@@ -92,19 +92,19 @@ describe('SearchType.Tabs', () => {
|
||||
</SearchContext.Provider>,
|
||||
);
|
||||
|
||||
user.click(getByText('All'));
|
||||
await user.click(getByText('All'));
|
||||
|
||||
expect(contextSpy.setTypes).toHaveBeenCalledWith([]);
|
||||
});
|
||||
|
||||
it('should reset page cursor when a new type is selected', () => {
|
||||
it('should reset page cursor when a new type is selected', async () => {
|
||||
const { getByText } = render(
|
||||
<SearchContext.Provider value={contextSpy}>
|
||||
<SearchType.Tabs types={[expectedType]} />
|
||||
</SearchContext.Provider>,
|
||||
);
|
||||
|
||||
user.click(getByText(expectedType.name));
|
||||
await user.click(getByText(expectedType.name));
|
||||
|
||||
expect(contextSpy.setPageCursor).toHaveBeenCalledWith(undefined);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user