mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 14:13:37 +08:00
fix: switch checkedChildren no height (#48513)
Co-authored-by: 二货机器人 <smith3816@gmail.com>
This commit is contained in:
parent
d524a4cd6c
commit
273104cb1d
@ -68,4 +68,12 @@ describe('Switch', () => {
|
||||
it('have static property for type detecting', () => {
|
||||
expect(Switch.__ANT_SWITCH).toBeTruthy();
|
||||
});
|
||||
|
||||
it('inner element have min-height', () => {
|
||||
const { container, rerender } = render(<Switch unCheckedChildren="0" size="small" />);
|
||||
expect(container.querySelector('.ant-switch-inner-unchecked')).toHaveStyle('min-height: 16px');
|
||||
|
||||
rerender(<Switch unCheckedChildren="0" />);
|
||||
expect(container.querySelector('.ant-switch-inner-unchecked')).toHaveStyle('min-height: 22px');
|
||||
});
|
||||
});
|
||||
|
@ -109,6 +109,11 @@ const genSwitchSmallStyle: GenerateStyle<SwitchToken, CSSObject> = (token) => {
|
||||
[`${componentCls}-inner`]: {
|
||||
paddingInlineStart: innerMaxMarginSM,
|
||||
paddingInlineEnd: innerMinMarginSM,
|
||||
|
||||
[`${switchInnerCls}-checked, ${switchInnerCls}-unchecked`]: {
|
||||
minHeight: trackHeightSM,
|
||||
},
|
||||
|
||||
[`${switchInnerCls}-checked`]: {
|
||||
marginInlineStart: `calc(-100% + ${trackPaddingCalc} - ${innerMaxMarginCalc})`,
|
||||
marginInlineEnd: `calc(100% - ${trackPaddingCalc} + ${innerMaxMarginCalc})`,
|
||||
@ -269,6 +274,7 @@ const genSwitchInnerStyle: GenerateStyle<SwitchToken, CSSObject> = (token) => {
|
||||
fontSize: token.fontSizeSM,
|
||||
transition: `margin-inline-start ${token.switchDuration} ease-in-out, margin-inline-end ${token.switchDuration} ease-in-out`,
|
||||
pointerEvents: 'none',
|
||||
minHeight: trackHeight,
|
||||
},
|
||||
|
||||
[`${switchInnerCls}-checked`]: {
|
||||
|
Loading…
Reference in New Issue
Block a user