mirror of
https://github.com/strapi/strapi.git
synced 2025-11-03 11:25:17 +00:00
Finish publish all modal
This commit is contained in:
parent
7a53339f75
commit
dc4c6a7877
@ -103,12 +103,14 @@ BulkActionsBar.defaultProps = {
|
||||
showPublish: false,
|
||||
showDelete: false,
|
||||
onConfirmDeleteAll() {},
|
||||
onConfirmPublishAll() {},
|
||||
};
|
||||
|
||||
BulkActionsBar.propTypes = {
|
||||
showPublish: PropTypes.bool,
|
||||
showDelete: PropTypes.bool,
|
||||
onConfirmDeleteAll: PropTypes.func,
|
||||
onConfirmPublishAll: PropTypes.func,
|
||||
selectedEntries: PropTypes.array.isRequired,
|
||||
clearSelectedEntries: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
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 { ThemeProvider, lightTheme } from '@strapi/design-system';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
@ -77,9 +77,23 @@ describe('BulkActionsBar', () => {
|
||||
onConfirmDeleteAll: mockConfirmDeleteAll,
|
||||
});
|
||||
|
||||
await user.click(screen.getByRole('button', { name: /\bDelete\b/ }));
|
||||
await user.click(screen.getByRole('button', { name: /confirm/i }));
|
||||
await act(async () => {
|
||||
await user.click(screen.getByRole('button', { name: /\bDelete\b/ }));
|
||||
await user.click(screen.getByRole('button', { name: /confirm/i }));
|
||||
});
|
||||
|
||||
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}
|
||||
variant="secondary"
|
||||
startIcon={<Check />}
|
||||
id="confirm-publish"
|
||||
data-testid="confirm-publish"
|
||||
loading={isConfirmButtonLoading}
|
||||
>
|
||||
{formatMessage({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user