mirror of
https://github.com/Unleash/unleash.git
synced 2025-06-04 01:18:20 +02:00
feat: adjust filter UI (#9720)
This commit is contained in:
parent
f8e75e5250
commit
1e027dcf4f
@ -76,14 +76,14 @@ const setupApi = (features: APIFeature[], projects: APIProject[]) => {
|
|||||||
|
|
||||||
const verifyTableFeature = async (feature: Partial<UIFeature>) => {
|
const verifyTableFeature = async (feature: Partial<UIFeature>) => {
|
||||||
await screen.findByText('Search');
|
await screen.findByText('Search');
|
||||||
await screen.findByText('Add Filter');
|
await screen.findByText('Filter');
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
Object.values(feature).map((value) => screen.findByText(value)),
|
Object.values(feature).map((value) => screen.findByText(value)),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const filterFeaturesByProject = async (projectName: string) => {
|
const filterFeaturesByProject = async (projectName: string) => {
|
||||||
const addFilterButton = screen.getByText('Add Filter');
|
const addFilterButton = screen.getByText('Filter');
|
||||||
addFilterButton.click();
|
addFilterButton.click();
|
||||||
|
|
||||||
const projectItem = await screen.findByText('Project');
|
const projectItem = await screen.findByText('Project');
|
||||||
|
@ -4,7 +4,7 @@ import Button from '@mui/material/Button';
|
|||||||
import Menu from '@mui/material/Menu';
|
import Menu from '@mui/material/Menu';
|
||||||
import MenuItem from '@mui/material/MenuItem';
|
import MenuItem from '@mui/material/MenuItem';
|
||||||
import { Icon, styled } from '@mui/material';
|
import { Icon, styled } from '@mui/material';
|
||||||
import Add from '@mui/icons-material/Add';
|
import FilterList from '@mui/icons-material/FilterList';
|
||||||
import { Box } from '@mui/system';
|
import { Box } from '@mui/system';
|
||||||
import type { IFilterItem } from './Filters/Filters';
|
import type { IFilterItem } from './Filters/Filters';
|
||||||
import { FILTERS_MENU } from 'utils/testIds';
|
import { FILTERS_MENU } from 'utils/testIds';
|
||||||
@ -117,13 +117,16 @@ export const AddFilterButton = ({
|
|||||||
describeChild
|
describeChild
|
||||||
open={archiveTooltipOpen}
|
open={archiveTooltipOpen}
|
||||||
>
|
>
|
||||||
<StyledButton onClick={handleClick} startIcon={<Add />}>
|
<StyledButton
|
||||||
Add Filter
|
onClick={handleClick}
|
||||||
|
startIcon={<FilterList />}
|
||||||
|
>
|
||||||
|
Filter
|
||||||
</StyledButton>
|
</StyledButton>
|
||||||
</StyledHtmlTooltip>
|
</StyledHtmlTooltip>
|
||||||
) : (
|
) : (
|
||||||
<StyledButton onClick={handleClick} startIcon={<Add />}>
|
<StyledButton onClick={handleClick} startIcon={<FilterList />}>
|
||||||
Add Filter
|
Filter
|
||||||
</StyledButton>
|
</StyledButton>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ test('should remove selected item from the add filter list', async () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// initial selection list
|
// initial selection list
|
||||||
const addFilterButton = await screen.findByText('Add Filter');
|
const addFilterButton = await screen.findByText('Filter');
|
||||||
fireEvent.click(addFilterButton);
|
fireEvent.click(addFilterButton);
|
||||||
expect((await screen.findByTestId(FILTERS_MENU)).textContent).toBe(
|
expect((await screen.findByTestId(FILTERS_MENU)).textContent).toBe(
|
||||||
'StateTags',
|
'StateTags',
|
||||||
|
@ -31,7 +31,7 @@ test('Filter insights by project and date', async () => {
|
|||||||
vi.setSystemTime(currentTime);
|
vi.setSystemTime(currentTime);
|
||||||
setupApi();
|
setupApi();
|
||||||
render(<Insights withCharts={false} />);
|
render(<Insights withCharts={false} />);
|
||||||
const addFilter = await screen.findByText('Add Filter');
|
const addFilter = await screen.findByText('Filter');
|
||||||
fireEvent.click(addFilter);
|
fireEvent.click(addFilter);
|
||||||
const projectFilter = await screen.findByText('Project');
|
const projectFilter = await screen.findByText('Project');
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ test('filters by flag author', async () => {
|
|||||||
route: '/projects/default',
|
route: '/projects/default',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
const addFilter = await screen.findByText('Add Filter');
|
const addFilter = await screen.findByText('Filter');
|
||||||
fireEvent.click(addFilter);
|
fireEvent.click(addFilter);
|
||||||
|
|
||||||
const createdBy = await screen.findByText('Created by');
|
const createdBy = await screen.findByText('Created by');
|
||||||
|
Loading…
Reference in New Issue
Block a user