mirror of
https://github.com/strapi/strapi.git
synced 2025-09-26 08:52:26 +00:00
add formDisabled test for EditFolderDialog
This commit is contained in:
parent
89cda31a8d
commit
c4ddaa7538
@ -8,6 +8,7 @@ import { QueryClientProvider, QueryClient } from 'react-query';
|
|||||||
|
|
||||||
import { EditFolderDialog } from '../EditFolderDialog';
|
import { EditFolderDialog } from '../EditFolderDialog';
|
||||||
import { useEditFolder } from '../../../hooks/useEditFolder';
|
import { useEditFolder } from '../../../hooks/useEditFolder';
|
||||||
|
import { useMediaLibraryPermissions } from '../../../hooks/useMediaLibraryPermissions';
|
||||||
|
|
||||||
jest.mock('../../../utils/axiosInstance', () => ({
|
jest.mock('../../../utils/axiosInstance', () => ({
|
||||||
...jest.requireActual('../../../utils/axiosInstance'),
|
...jest.requireActual('../../../utils/axiosInstance'),
|
||||||
@ -216,4 +217,14 @@ describe('EditFolderDialog', () => {
|
|||||||
|
|
||||||
expect(getByText(FIXTURE_ERROR_MESSAGE)).toBeInTheDocument();
|
expect(getByText(FIXTURE_ERROR_MESSAGE)).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('disables inputs and submit action if users do not have permissions to update', () => {
|
||||||
|
useMediaLibraryPermissions.mockReturnValueOnce({ canUpdate: false });
|
||||||
|
const { getByRole } = setup();
|
||||||
|
|
||||||
|
expect(getByRole('textbox', { name: 'Name' })).toHaveAttribute('aria-disabled', 'true');
|
||||||
|
expect(getByRole('combobox', { name: 'Location' })).toBeDisabled();
|
||||||
|
|
||||||
|
expect(getByRole('button', { name: 'Create' })).toBeDisabled();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user