mirror of
https://github.com/strapi/strapi.git
synced 2025-09-25 16:29:34 +00:00
adapt cog button to creator fields
This commit is contained in:
parent
9b71fdd3b5
commit
97a37fa857
@ -1,4 +1,4 @@
|
||||
import React, { useRef, useState } from 'react';
|
||||
import React from 'react';
|
||||
|
||||
import { Button } from '@strapi/design-system';
|
||||
import { FilterListURLQuery, FilterPopoverURLQuery, useTracking } from '@strapi/helper-plugin';
|
||||
@ -7,9 +7,9 @@ import PropTypes from 'prop-types';
|
||||
import { useIntl } from 'react-intl';
|
||||
|
||||
export const Filter = ({ displayedFilters }) => {
|
||||
const [isVisible, setIsVisible] = useState(false);
|
||||
const [isVisible, setIsVisible] = React.useState(false);
|
||||
const { formatMessage } = useIntl();
|
||||
const buttonRef = useRef();
|
||||
const buttonRef = React.useRef();
|
||||
const { trackUsage } = useTracking();
|
||||
|
||||
const handleToggle = () => {
|
||||
@ -24,7 +24,7 @@ export const Filter = ({ displayedFilters }) => {
|
||||
<Button
|
||||
variant="tertiary"
|
||||
ref={buttonRef}
|
||||
startIcon={<Filter />}
|
||||
startIcon={<FilterIcon />}
|
||||
onClick={handleToggle}
|
||||
size="S"
|
||||
>
|
||||
|
@ -139,10 +139,6 @@ describe('Bulk publish selected entries modal', () => {
|
||||
server.listen();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
server.resetHandlers();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
server.close();
|
||||
});
|
||||
@ -213,9 +209,11 @@ describe('Bulk publish selected entries modal', () => {
|
||||
});
|
||||
|
||||
it('should publish valid entries after confirming and close the modal', async () => {
|
||||
const mockOnToggle = jest.fn();
|
||||
|
||||
const { queryByText } = render(
|
||||
<Table.Root defaultSelectedEntries={[1, 2, 3]} colCount={4}>
|
||||
<SelectedEntriesModal onToggle={jest.fn()} />
|
||||
<SelectedEntriesModal onToggle={mockOnToggle} />
|
||||
</Table.Root>
|
||||
);
|
||||
|
||||
@ -237,11 +235,7 @@ describe('Bulk publish selected entries modal', () => {
|
||||
expect(publishDialog).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.queryByRole('gridcell', { name: 'Entry 1' })).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole('gridcell', { name: 'Entry 2' })).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole('gridcell', { name: 'Entry 3' })).not.toBeInTheDocument();
|
||||
});
|
||||
expect(mockOnToggle).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('should only keep entries with validation errors in the modal after publish', async () => {
|
||||
@ -297,6 +291,8 @@ describe('Bulk publish selected entries modal', () => {
|
||||
screen.getByRole('gridcell', { name: 'components.Input.error.validation.required' })
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
server.restoreHandlers();
|
||||
});
|
||||
|
||||
it('should show validation errors if there is an error', async () => {
|
||||
@ -347,6 +343,8 @@ describe('Bulk publish selected entries modal', () => {
|
||||
await waitFor(() => {
|
||||
expect(publishButton).toBeDisabled();
|
||||
});
|
||||
|
||||
server.restoreHandlers();
|
||||
});
|
||||
|
||||
it('should show the correct messages above the table in the selected entries modal', async () => {
|
||||
@ -399,5 +397,6 @@ describe('Bulk publish selected entries modal', () => {
|
||||
exact: false,
|
||||
});
|
||||
expect(countWithErrors).toHaveTextContent('1 entry waiting for action');
|
||||
server.restoreHandlers();
|
||||
});
|
||||
});
|
||||
|
@ -95,7 +95,6 @@ function ListView({
|
||||
const fetchPermissionsRef = React.useRef(refetchPermissions);
|
||||
const { notifyStatus } = useNotifyAT();
|
||||
const { formatAPIError } = useAPIErrorHandler(getTrad);
|
||||
const permissions = useSelector(selectAdminPermissions);
|
||||
const allowedAttributes = useAllowedAttributes(contentType, slug);
|
||||
const [{ query }] = useQueryParams();
|
||||
const { pathname } = useLocation();
|
||||
|
Loading…
x
Reference in New Issue
Block a user