mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-03 20:49:14 +08:00
Merge pull request #18138 from laysent/master
fix: tooltip not work with disabled checkbox
This commit is contained in:
commit
81cf7bd520
@ -46,6 +46,8 @@ export interface CheckboxChangeEvent {
|
|||||||
class Checkbox extends React.Component<CheckboxProps, {}> {
|
class Checkbox extends React.Component<CheckboxProps, {}> {
|
||||||
static Group: typeof CheckboxGroup;
|
static Group: typeof CheckboxGroup;
|
||||||
|
|
||||||
|
static __ANT_CHECKBOX = true;
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
indeterminate: false,
|
indeterminate: false,
|
||||||
};
|
};
|
||||||
|
@ -13,6 +13,31 @@ exports[`Tooltip should hide when mouse leave antd disabled component Button 1`]
|
|||||||
</span>
|
</span>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`Tooltip should hide when mouse leave antd disabled component Checkbox 1`] = `
|
||||||
|
<span
|
||||||
|
style="display: inline-block; cursor: not-allowed;"
|
||||||
|
>
|
||||||
|
<label
|
||||||
|
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled"
|
||||||
|
style="pointer-events: none;"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="ant-checkbox ant-checkbox-disabled"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
class="ant-checkbox-input"
|
||||||
|
disabled=""
|
||||||
|
type="checkbox"
|
||||||
|
value=""
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
class="ant-checkbox-inner"
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</span>
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`Tooltip should hide when mouse leave antd disabled component Switch 1`] = `
|
exports[`Tooltip should hide when mouse leave antd disabled component Switch 1`] = `
|
||||||
<span
|
<span
|
||||||
style="display: inline-block; cursor: not-allowed;"
|
style="display: inline-block; cursor: not-allowed;"
|
||||||
|
@ -3,6 +3,7 @@ import { mount } from 'enzyme';
|
|||||||
import Tooltip from '..';
|
import Tooltip from '..';
|
||||||
import Button from '../../button';
|
import Button from '../../button';
|
||||||
import Switch from '../../switch';
|
import Switch from '../../switch';
|
||||||
|
import Checkbox from '../../checkbox';
|
||||||
import DatePicker from '../../date-picker';
|
import DatePicker from '../../date-picker';
|
||||||
import Input from '../../input';
|
import Input from '../../input';
|
||||||
import Group from '../../input/Group';
|
import Group from '../../input/Group';
|
||||||
@ -107,6 +108,7 @@ describe('Tooltip', () => {
|
|||||||
|
|
||||||
testComponent('Button', Button);
|
testComponent('Button', Button);
|
||||||
testComponent('Switch', Switch);
|
testComponent('Switch', Switch);
|
||||||
|
testComponent('Checkbox', Checkbox);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should render disabled Button style properly', () => {
|
it('should render disabled Button style properly', () => {
|
||||||
|
@ -87,7 +87,10 @@ const splitObject = (obj: any, keys: string[]) => {
|
|||||||
function getDisabledCompatibleChildren(element: React.ReactElement<any>) {
|
function getDisabledCompatibleChildren(element: React.ReactElement<any>) {
|
||||||
const elementType = element.type as any;
|
const elementType = element.type as any;
|
||||||
if (
|
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
|
element.props.disabled
|
||||||
) {
|
) {
|
||||||
// Pick some layout related style properties up to span
|
// Pick some layout related style properties up to span
|
||||||
|
Loading…
Reference in New Issue
Block a user