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