Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix errors and warnings in tests #6299

Merged
merged 1 commit into from
May 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 24 additions & 9 deletions packages/ra-ui-materialui/src/button/SaveButton.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ describe('<SaveButton />', () => {
<TestContext>
<ThemeProvider theme={theme}>
<SaveContextProvider value={saveContextValue}>
<SaveButton {...invalidButtonDomProps} />
<FormContextProvider value={formContextValue}>
<SaveButton {...invalidButtonDomProps} />
</FormContextProvider>
</SaveContextProvider>
</ThemeProvider>
</TestContext>
Expand All @@ -75,7 +77,9 @@ describe('<SaveButton />', () => {
<TestContext>
<ThemeProvider theme={theme}>
<SaveContextProvider value={saveContextValue}>
<SaveButton disabled={true} />
<FormContextProvider value={formContextValue}>
<SaveButton disabled={true} />
</FormContextProvider>
</SaveContextProvider>
</ThemeProvider>
</TestContext>
Expand All @@ -87,7 +91,9 @@ describe('<SaveButton />', () => {
const { getByLabelText } = render(
<TestContext>
<SaveContextProvider value={saveContextValue}>
<SaveButton submitOnEnter />
<FormContextProvider value={formContextValue}>
<SaveButton submitOnEnter />
</FormContextProvider>
</SaveContextProvider>
</TestContext>
);
Expand All @@ -100,7 +106,9 @@ describe('<SaveButton />', () => {
const { getByLabelText } = render(
<TestContext>
<SaveContextProvider value={saveContextValue}>
<SaveButton submitOnEnter={false} />
<FormContextProvider value={formContextValue}>
<SaveButton submitOnEnter={false} />
</FormContextProvider>
</SaveContextProvider>
</TestContext>
);
Expand Down Expand Up @@ -135,7 +143,12 @@ describe('<SaveButton />', () => {
const { getByLabelText } = render(
<TestContext>
<SaveContextProvider value={saveContextValue}>
<SaveButton handleSubmitWithRedirect={onSubmit} saving />
<FormContextProvider value={formContextValue}>
<SaveButton
handleSubmitWithRedirect={onSubmit}
saving
/>
</FormContextProvider>
</SaveContextProvider>
</TestContext>
);
Expand All @@ -154,10 +167,12 @@ describe('<SaveButton />', () => {
dispatchSpy = jest.spyOn(store, 'dispatch');
return (
<SaveContextProvider value={saveContextValue}>
<SaveButton
handleSubmitWithRedirect={onSubmit}
invalid
/>
<FormContextProvider value={formContextValue}>
<SaveButton
handleSubmitWithRedirect={onSubmit}
invalid
/>
</FormContextProvider>
</SaveContextProvider>
);
}}
Expand Down
4 changes: 3 additions & 1 deletion packages/ra-ui-materialui/src/field/ArrayField.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import TextField from './TextField';
import Datagrid from '../list/datagrid/Datagrid';

describe('<ArrayField />', () => {
const currentSort = { field: 'id', order: 'ASC' };

const DummyIterator = props => (
<Datagrid {...props}>
<Datagrid {...props} currentSort={currentSort}>
<NumberField source="id" />
<TextField source="foo" />
</Datagrid>
Expand Down
9 changes: 6 additions & 3 deletions packages/ra-ui-materialui/src/list/List.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ describe('<List />', () => {
<List {...defaultProps}>
<Datagrid />
</List>
</ThemeProvider>
</ThemeProvider>,
defaultStateForList
);
expect(container.querySelectorAll('.list-page')).toHaveLength(1);
});
Expand All @@ -70,7 +71,8 @@ describe('<List />', () => {
<Datagrid />
</List>
</MemoryRouter>
</ThemeProvider>
</ThemeProvider>,
defaultStateForList
);
expect(queryAllByText('filters')).toHaveLength(2);
expect(queryAllByLabelText('ra.action.export')).toHaveLength(1);
Expand All @@ -86,7 +88,8 @@ describe('<List />', () => {
<List {...defaultProps} aside={<Aside />}>
<Dummy />
</List>
</ThemeProvider>
</ThemeProvider>,
defaultStateForList
);
expect(queryAllByText('Hello')).toHaveLength(1);
});
Expand Down