mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 19:19:57 +08:00
fix: hidden should higher than noStyle (#26020)
This commit is contained in:
parent
683750c396
commit
c345580ea2
@ -142,7 +142,7 @@ function FormItem(props: FormItemProps): React.ReactElement {
|
|||||||
meta?: Meta,
|
meta?: Meta,
|
||||||
isRequired?: boolean,
|
isRequired?: boolean,
|
||||||
): React.ReactNode {
|
): React.ReactNode {
|
||||||
if (noStyle) {
|
if (noStyle && !hidden) {
|
||||||
return baseChildren;
|
return baseChildren;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,35 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`Form Form item hidden 1`] = `
|
exports[`Form Form item hidden noStyle should not work when hidden 1`] = `
|
||||||
|
<form
|
||||||
|
class="ant-form ant-form-horizontal"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="ant-row ant-form-item ant-form-item-hidden"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="ant-col ant-form-item-control"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="ant-form-item-control-input"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="ant-form-item-control-input-content"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
class="ant-input"
|
||||||
|
id="light"
|
||||||
|
type="text"
|
||||||
|
value=""
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`Form Form item hidden should work 1`] = `
|
||||||
<form
|
<form
|
||||||
class="ant-form ant-form-horizontal"
|
class="ant-form ant-form-horizontal"
|
||||||
>
|
>
|
||||||
|
@ -699,7 +699,8 @@ describe('Form', () => {
|
|||||||
expect(wrapper.find('input').prop('onBlur')).toBeTruthy();
|
expect(wrapper.find('input').prop('onBlur')).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Form item hidden', () => {
|
describe('Form item hidden', () => {
|
||||||
|
it('should work', () => {
|
||||||
const wrapper = mount(
|
const wrapper = mount(
|
||||||
<Form>
|
<Form>
|
||||||
<Form.Item name="light" hidden>
|
<Form.Item name="light" hidden>
|
||||||
@ -709,4 +710,16 @@ describe('Form', () => {
|
|||||||
);
|
);
|
||||||
expect(wrapper).toMatchRenderedSnapshot();
|
expect(wrapper).toMatchRenderedSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('noStyle should not work when hidden', () => {
|
||||||
|
const wrapper = mount(
|
||||||
|
<Form>
|
||||||
|
<Form.Item name="light" hidden noStyle>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
</Form>,
|
||||||
|
);
|
||||||
|
expect(wrapper).toMatchRenderedSnapshot();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user