Browse Source

fix: validated should be reset when trigger reset event (#41976)

pull/41983/head
kiner-tang(文辉) 2 years ago
committed by GitHub
parent
commit
b31bec59af
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 35
      components/form/__tests__/__snapshots__/demo-extend.test.ts.snap
  2. 35
      components/form/__tests__/__snapshots__/demo.test.tsx.snap
  3. 12
      components/form/demo/validate-other.tsx
  4. 2
      package.json

35
components/form/__tests__/__snapshots__/demo-extend.test.ts.snap

@ -20625,14 +20625,35 @@ exports[`renders components/form/demo/validate-other.tsx extend context correctl
<div
class="ant-form-item-control-input-content"
>
<button
class="ant-btn ant-btn-primary"
type="submit"
<div
class="ant-space ant-space-horizontal ant-space-align-center"
>
<span>
Submit
</span>
</button>
<div
class="ant-space-item"
style="margin-right: 8px;"
>
<button
class="ant-btn ant-btn-primary"
type="submit"
>
<span>
Submit
</span>
</button>
</div>
<div
class="ant-space-item"
>
<button
class="ant-btn ant-btn-default"
type="reset"
>
<span>
reset
</span>
</button>
</div>
</div>
</div>
</div>
</div>

35
components/form/__tests__/__snapshots__/demo.test.tsx.snap

@ -9505,14 +9505,35 @@ exports[`renders components/form/demo/validate-other.tsx correctly 1`] = `
<div
class="ant-form-item-control-input-content"
>
<button
class="ant-btn ant-btn-primary"
type="submit"
<div
class="ant-space ant-space-horizontal ant-space-align-center"
>
<span>
Submit
</span>
</button>
<div
class="ant-space-item"
style="margin-right:8px"
>
<button
class="ant-btn ant-btn-primary"
type="submit"
>
<span>
Submit
</span>
</button>
</div>
<div
class="ant-space-item"
>
<button
class="ant-btn ant-btn-default"
type="reset"
>
<span>
reset
</span>
</button>
</div>
</div>
</div>
</div>
</div>

12
components/form/demo/validate-other.tsx

@ -1,4 +1,3 @@
import React from 'react';
import { InboxOutlined, UploadOutlined } from '@ant-design/icons';
import {
Button,
@ -11,9 +10,11 @@ import {
Row,
Select,
Slider,
Space,
Switch,
Upload,
} from 'antd';
import React from 'react';
const { Option } = Select;
@ -181,9 +182,12 @@ const App: React.FC = () => (
</Form.Item>
<Form.Item wrapperCol={{ span: 12, offset: 6 }}>
<Button type="primary" htmlType="submit">
Submit
</Button>
<Space>
<Button type="primary" htmlType="submit">
Submit
</Button>
<Button htmlType="reset">reset</Button>
</Space>
</Form.Item>
</Form>
);

2
package.json

@ -126,7 +126,7 @@
"rc-dialog": "~9.1.0",
"rc-drawer": "~6.1.1",
"rc-dropdown": "~4.0.0",
"rc-field-form": "~1.29.0",
"rc-field-form": "~1.30.0",
"rc-image": "~5.16.0",
"rc-input": "~1.0.4",
"rc-input-number": "~7.4.0",

Loading…
Cancel
Save