diff --git a/__tests__/renderers/Form/formitem.test.tsx b/__tests__/renderers/Form/formitem.test.tsx index bdf7c6b6a..ab7d26ebd 100644 --- a/__tests__/renderers/Form/formitem.test.tsx +++ b/__tests__/renderers/Form/formitem.test.tsx @@ -60,10 +60,7 @@ test('Renderer:FormItem:validateApi:success', async () => { expect(onSubmit).not.toHaveBeenCalled(); await wait(100); - expect(notify).toHaveBeenCalledWith( - 'error', - '依赖的部分字段没有通过验证\n这是必填项' - ); + expect(notify).toHaveBeenCalledWith('error', '依赖的部分字段没有通过验证'); const input = container.querySelector('input[name=a]'); expect(input).toBeTruthy(); @@ -132,10 +129,7 @@ test('Renderer:FormItem:validateApi:failed', async () => { expect(onSubmit).not.toHaveBeenCalled(); await wait(100); - expect(notify).toHaveBeenCalledWith( - 'error', - '依赖的部分字段没有通过验证\n这是必填项' - ); + expect(notify).toHaveBeenCalledWith('error', '依赖的部分字段没有通过验证'); const input = container.querySelector('input[name=a]'); expect(input).toBeTruthy(); diff --git a/__tests__/renderers/Form/formula.test.tsx b/__tests__/renderers/Form/formula.test.tsx index 691f0ac39..7fd687005 100644 --- a/__tests__/renderers/Form/formula.test.tsx +++ b/__tests__/renderers/Form/formula.test.tsx @@ -88,7 +88,7 @@ test('Renderer:formula', async () => { value: 2 } }); - await wait(100); + await wait(600); expect(inputs[2].value).toBe('3'); expect(inputs[3].value).toBe('4'); expect(inputs[4].value).toBe('5'); diff --git a/__tests__/renderers/Form/index.test.tsx b/__tests__/renderers/Form/index.test.tsx index 06ada4663..53da52562 100644 --- a/__tests__/renderers/Form/index.test.tsx +++ b/__tests__/renderers/Form/index.test.tsx @@ -106,10 +106,7 @@ test('Renderer:Form:valdiate', async () => { expect(onSubmit).not.toHaveBeenCalled(); await wait(100); - expect(notify).toHaveBeenCalledWith( - 'error', - '依赖的部分字段没有通过验证\n这是必填项' - ); + expect(notify).toHaveBeenCalledWith('error', '依赖的部分字段没有通过验证'); const input = container.querySelector('input[name=a]'); expect(input).toBeTruthy(); @@ -231,10 +228,7 @@ test('Renderer:Form:onValidate', async () => { expect(onValidate.mock.calls[0][0]).toMatchSnapshot(); await wait(100); - expect(notify).toHaveBeenCalledWith( - 'error', - '依赖的部分字段没有通过验证\na is wrong\nb is wrong\nb is wrong 2' - ); + expect(notify).toHaveBeenCalledWith('error', '依赖的部分字段没有通过验证'); fireEvent.click(getByText('Submit')); await wait(100); diff --git a/__tests__/renderers/Form/range.test.tsx b/__tests__/renderers/Form/range.test.tsx index c1c8bfd05..95e7c7971 100644 --- a/__tests__/renderers/Form/range.test.tsx +++ b/__tests__/renderers/Form/range.test.tsx @@ -26,7 +26,7 @@ test('Renderer:range', async () => { ) ); - const slider = container.querySelector('.cxd-InputRange-handle'); + const slider = container.querySelector('.cxd-InputRange-handle')!; fireEvent.mouseDown(slider); fireEvent.mouseMove(slider, { clientX: 400, diff --git a/src/store/form.ts b/src/store/form.ts index 244f360af..7ccad630c 100644 --- a/src/store/form.ts +++ b/src/store/form.ts @@ -474,15 +474,6 @@ export const FormStore = ServiceStore.named('FormStore') ) { let msg = failedMessage ?? self.__('Form.validateFailed'); const env = getEnv(self); - // 同时也列出所有表单项报错,方便在很长的表单中知道是哪个字段的问题 - // 支持在env中配hideValidateFailedDetail来隐藏所有表单项报错 - failedMessage == null && - !env.hideValidateFailedDetail && - self.items.forEach(item => { - item.errorData.forEach(errorData => { - msg = `${msg}\n${errorData.msg}`; - }); - }); msg && env.notify('error', msg);