Adjust tests to use only text & test drawer visibility
Signed-off-by: Philipp Hugenroth <philipph@spotify.com>
This commit is contained in:
@@ -248,13 +248,17 @@ describe('CatalogPage', () => {
|
||||
|
||||
it('should wrap filter in drawer on smaller screens', async () => {
|
||||
mockBreakpoint({ matches: true });
|
||||
const { getByTestId } = await renderWrapped(<CatalogPage />);
|
||||
expect(getByTestId('entity-filters-drawer')).toBeInTheDocument();
|
||||
const { getAllByText } = await renderWrapped(<CatalogPage />);
|
||||
const elems = getAllByText('Filters');
|
||||
expect(elems[0]).toBeVisible();
|
||||
expect(elems[1]).not.toBeVisible();
|
||||
fireEvent.click(elems[0]);
|
||||
expect(elems[1]).toBeVisible();
|
||||
});
|
||||
|
||||
it('should wrap filter in grid on larger screens', async () => {
|
||||
mockBreakpoint({ matches: false });
|
||||
const { getByTestId } = await renderWrapped(<CatalogPage />);
|
||||
expect(getByTestId('entity-filters-grid')).toBeInTheDocument();
|
||||
const { queryAllByText } = await renderWrapped(<CatalogPage />);
|
||||
expect(queryAllByText('Filters').length).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -44,7 +44,6 @@ export const FilterContainer = ({ children }: PropsWithChildren<{}>) => {
|
||||
Filters
|
||||
</Button>
|
||||
<Drawer
|
||||
data-testid="entity-filters-drawer"
|
||||
open={filterDrawerOpen}
|
||||
onClose={() => setFilterDrawerOpen(false)}
|
||||
anchor="left"
|
||||
@@ -65,7 +64,7 @@ export const FilterContainer = ({ children }: PropsWithChildren<{}>) => {
|
||||
</Drawer>
|
||||
</>
|
||||
) : (
|
||||
<Grid data-testid="entity-filters-grid" item lg={2}>
|
||||
<Grid item lg={2}>
|
||||
{children}
|
||||
</Grid>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user