Fix tests and add the one in todo

This commit is contained in:
Christian Capeans 2023-09-04 18:13:03 +02:00
parent ae7bff1546
commit 0bdf9f341f
3 changed files with 13 additions and 7 deletions

View File

@ -248,8 +248,6 @@ const IconButtonCustom = styled(IconButton)`
}
`;
// TODO: Delete once https://github.com/strapi/design-system/pull/858
// is merged and released.
const StyledBox = styled(Box)`
> div:first-child {
box-shadow: ${({ theme }) => theme.shadows.tableShadow};

View File

@ -198,5 +198,12 @@ describe('DynamicComponent', () => {
});
});
it.todo('should handle errors in the fields');
it('should handle errors in the fields', async () => {
const { getByText } = render({
index: 0,
formErrors: { [`${defaultProps.name}.0`]: 'Error here' },
});
expect(getByText('The component contains error(s)')).toBeInTheDocument();
});
});

View File

@ -2,7 +2,7 @@ import React from 'react';
import { lightTheme, ThemeProvider } from '@strapi/design-system';
import { useCMEditViewDataManager } from '@strapi/helper-plugin';
import { render as renderRTL } from '@testing-library/react';
import { render as renderRTL, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { DndProvider } from 'react-dnd';
import { HTML5Backend } from 'react-dnd-html5-backend';
@ -299,9 +299,10 @@ describe('DynamicZone', () => {
const [draggedItem] = getAllByRole('button', { name: 'Drag' });
draggedItem.focus();
await user.keyboard('[Space]');
await waitFor(() => {
draggedItem.focus();
user.keyboard('[Space]');
});
expect(
queryByText(