mirror of
https://github.com/strapi/strapi.git
synced 2025-11-12 08:08:05 +00:00
Finish publish all modal
This commit is contained in:
parent
7a53339f75
commit
dc4c6a7877
@ -103,12 +103,14 @@ BulkActionsBar.defaultProps = {
|
|||||||
showPublish: false,
|
showPublish: false,
|
||||||
showDelete: false,
|
showDelete: false,
|
||||||
onConfirmDeleteAll() {},
|
onConfirmDeleteAll() {},
|
||||||
|
onConfirmPublishAll() {},
|
||||||
};
|
};
|
||||||
|
|
||||||
BulkActionsBar.propTypes = {
|
BulkActionsBar.propTypes = {
|
||||||
showPublish: PropTypes.bool,
|
showPublish: PropTypes.bool,
|
||||||
showDelete: PropTypes.bool,
|
showDelete: PropTypes.bool,
|
||||||
onConfirmDeleteAll: PropTypes.func,
|
onConfirmDeleteAll: PropTypes.func,
|
||||||
|
onConfirmPublishAll: PropTypes.func,
|
||||||
selectedEntries: PropTypes.array.isRequired,
|
selectedEntries: PropTypes.array.isRequired,
|
||||||
clearSelectedEntries: PropTypes.func.isRequired,
|
clearSelectedEntries: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { render, screen } from '@testing-library/react';
|
import { act, render, screen } from '@testing-library/react';
|
||||||
import userEvent from '@testing-library/user-event';
|
import userEvent from '@testing-library/user-event';
|
||||||
import { ThemeProvider, lightTheme } from '@strapi/design-system';
|
import { ThemeProvider, lightTheme } from '@strapi/design-system';
|
||||||
import { IntlProvider } from 'react-intl';
|
import { IntlProvider } from 'react-intl';
|
||||||
@ -77,9 +77,23 @@ describe('BulkActionsBar', () => {
|
|||||||
onConfirmDeleteAll: mockConfirmDeleteAll,
|
onConfirmDeleteAll: mockConfirmDeleteAll,
|
||||||
});
|
});
|
||||||
|
|
||||||
await user.click(screen.getByRole('button', { name: /\bDelete\b/ }));
|
await act(async () => {
|
||||||
await user.click(screen.getByRole('button', { name: /confirm/i }));
|
await user.click(screen.getByRole('button', { name: /\bDelete\b/ }));
|
||||||
|
await user.click(screen.getByRole('button', { name: /confirm/i }));
|
||||||
|
});
|
||||||
|
|
||||||
expect(mockConfirmDeleteAll).toHaveBeenCalledWith([]);
|
expect(mockConfirmDeleteAll).toHaveBeenCalledWith([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should show publish modal if publish button is clicked', async () => {
|
||||||
|
const onConfirmPublishAll = jest.fn();
|
||||||
|
setup({ showPublish: true, onConfirmPublishAll });
|
||||||
|
|
||||||
|
await act(async () => {
|
||||||
|
await user.click(screen.getByRole('button', { name: /\bpublish\b/i }));
|
||||||
|
await user.click(screen.getByTestId('confirm-publish'));
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(onConfirmPublishAll).toHaveBeenCalledWith([]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -49,7 +49,7 @@ const ConfirmDialogPublishAll = ({ isConfirmButtonLoading, isOpen, onToggleDialo
|
|||||||
onClick={onConfirm}
|
onClick={onConfirm}
|
||||||
variant="secondary"
|
variant="secondary"
|
||||||
startIcon={<Check />}
|
startIcon={<Check />}
|
||||||
id="confirm-publish"
|
data-testid="confirm-publish"
|
||||||
loading={isConfirmButtonLoading}
|
loading={isConfirmButtonLoading}
|
||||||
>
|
>
|
||||||
{formatMessage({
|
{formatMessage({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user