diff --git a/components/checkbox/Checkbox.tsx b/components/checkbox/Checkbox.tsx index a48fb0679e..687b3f52f1 100644 --- a/components/checkbox/Checkbox.tsx +++ b/components/checkbox/Checkbox.tsx @@ -46,6 +46,8 @@ export interface CheckboxChangeEvent { class Checkbox extends React.Component { static Group: typeof CheckboxGroup; + static __ANT_CHECKBOX = true; + static defaultProps = { indeterminate: false, }; diff --git a/components/tooltip/__tests__/__snapshots__/tooltip.test.js.snap b/components/tooltip/__tests__/__snapshots__/tooltip.test.js.snap index 067c6a197c..2419f11850 100644 --- a/components/tooltip/__tests__/__snapshots__/tooltip.test.js.snap +++ b/components/tooltip/__tests__/__snapshots__/tooltip.test.js.snap @@ -13,6 +13,31 @@ exports[`Tooltip should hide when mouse leave antd disabled component Button 1`] `; +exports[`Tooltip should hide when mouse leave antd disabled component Checkbox 1`] = ` + + + +`; + exports[`Tooltip should hide when mouse leave antd disabled component Switch 1`] = ` { testComponent('Button', Button); testComponent('Switch', Switch); + testComponent('Checkbox', Checkbox); }); it('should render disabled Button style properly', () => { diff --git a/components/tooltip/index.tsx b/components/tooltip/index.tsx index cfae3659ad..fed77396ca 100644 --- a/components/tooltip/index.tsx +++ b/components/tooltip/index.tsx @@ -87,7 +87,10 @@ const splitObject = (obj: any, keys: string[]) => { function getDisabledCompatibleChildren(element: React.ReactElement) { const elementType = element.type as any; if ( - (elementType.__ANT_BUTTON || elementType.__ANT_SWITCH || element.type === 'button') && + (elementType.__ANT_BUTTON || + elementType.__ANT_SWITCH || + elementType.__ANT_CHECKBOX || + element.type === 'button') && element.props.disabled ) { // Pick some layout related style properties up to span