From 93113607bd5cbd10b5277c1fc161122d9aa8b2de Mon Sep 17 00:00:00 2001 From: tkow Date: Thu, 16 Dec 2021 21:18:25 +0900 Subject: [PATCH] feat: add onSubmitRemove prop test --- .../src/input/FileInput.spec.tsx | 216 +++++++++++++++++- 1 file changed, 214 insertions(+), 2 deletions(-) diff --git a/packages/ra-ui-materialui/src/input/FileInput.spec.tsx b/packages/ra-ui-materialui/src/input/FileInput.spec.tsx index ca2c9314f2b..d6df7888f59 100644 --- a/packages/ra-ui-materialui/src/input/FileInput.spec.tsx +++ b/packages/ra-ui-materialui/src/input/FileInput.spec.tsx @@ -1,7 +1,11 @@ import * as React from 'react'; -import { render, fireEvent } from '@testing-library/react'; +import { + render, + fireEvent, + waitForElementToBeRemoved, + waitFor, +} from '@testing-library/react'; import { Form } from 'react-final-form'; - import { FileField, ImageField } from '../field'; import { FileInput } from './FileInput'; @@ -247,6 +251,214 @@ describe('', () => { }); }); + describe('should stop to remove file field onSubmitReview return false', () => { + it('normal function', async () => { + const onSubmit = jest.fn(); + + const { getByLabelText, getByTitle } = render( +
( + + false} + > + + +