diff --git a/components/config-provider/__tests__/style.test.tsx b/components/config-provider/__tests__/style.test.tsx index dab45def76..17ba50b024 100644 --- a/components/config-provider/__tests__/style.test.tsx +++ b/components/config-provider/__tests__/style.test.tsx @@ -8,6 +8,7 @@ import Checkbox from '../../checkbox'; import Descriptions from '../../descriptions'; import Divider from '../../divider'; import Empty from '../../empty'; +import Form from '../../form'; import Image from '../../image'; import Input from '../../input'; import Mentions from '../../mentions'; @@ -242,6 +243,22 @@ describe('ConfigProvider support style and className props', () => { expect(element).toHaveStyle({ backgroundColor: 'red' }); }); + it('Should Form className & style works', () => { + const { container } = render( + +
+ + + +
+
, + ); + + const element = container.querySelector('.ant-form'); + expect(element).toHaveClass('cp-form'); + expect(element).toHaveStyle({ backgroundColor: 'red' }); + }); + it('Should Image className & style works', () => { const { container } = render( = (p requiredMark, onFinishFailed, name, + style, ...restFormProps } = props; @@ -107,6 +108,7 @@ const InternalForm: React.ForwardRefRenderFunction = (p [`${prefixCls}-${mergedSize}`]: mergedSize, }, hashId, + contextForm?.className, className, rootClassName, ); @@ -174,6 +176,7 @@ const InternalForm: React.ForwardRefRenderFunction = (p name={name} onFinishFailed={onInternalFinishFailed} form={wrapForm} + style={{ ...contextForm?.style, ...style }} className={formClassName} />