From 910d0fc3404dbfc16caddb96a45914d59e0d889c Mon Sep 17 00:00:00 2001 From: JiaQi <112228030+Yuiai01@users.noreply.github.com> Date: Wed, 15 Feb 2023 13:21:53 +0800 Subject: [PATCH] fix: inconsistency between checkbox and radio in table when Form is disabled (#40728) --- components/radio/__tests__/radio.test.tsx | 12 ++++++++++++ components/radio/radio.tsx | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/components/radio/__tests__/radio.test.tsx b/components/radio/__tests__/radio.test.tsx index 633f0b50ca..a0a35cb277 100644 --- a/components/radio/__tests__/radio.test.tsx +++ b/components/radio/__tests__/radio.test.tsx @@ -1,5 +1,6 @@ import React from 'react'; import Radio, { Button, Group } from '..'; +import Form from '../../form'; import focusTest from '../../../tests/shared/focusTest'; import mountTest from '../../../tests/shared/mountTest'; import rtlTest from '../../../tests/shared/rtlTest'; @@ -33,4 +34,15 @@ describe('Radio', () => { fireEvent.mouseLeave(container.querySelector('label')!); expect(onMouseLeave).toHaveBeenCalled(); }); + + it('should use own disabled status first', () => { + const { container } = render( +
, + ); + expect(container.querySelector('.ant-radio-wrapper')).not.toHaveClass( + 'ant-radio-wrapper-disabled', + ); + }); }); diff --git a/components/radio/radio.tsx b/components/radio/radio.tsx index a3ce3d7a97..fdd50c8870 100644 --- a/components/radio/radio.tsx +++ b/components/radio/radio.tsx @@ -49,7 +49,7 @@ const InternalRadio: React.ForwardRefRenderFunction