mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-05 23:46:28 +08:00
test: increase test cov for Layout and Typography (#23407)
This commit is contained in:
parent
40afa44673
commit
fc98ab7222
@ -50,7 +50,6 @@ type InternalSideProps = SiderProps & LayoutContextProps;
|
||||
export interface SiderState {
|
||||
collapsed?: boolean;
|
||||
below: boolean;
|
||||
belowShow?: boolean;
|
||||
}
|
||||
|
||||
const generateId = (() => {
|
||||
@ -124,6 +123,7 @@ class InternalSider extends React.Component<InternalSideProps, SiderState> {
|
||||
}
|
||||
|
||||
if (this.props.siderHook) {
|
||||
console.log('removeSider');
|
||||
this.props.siderHook.removeSider(this.uniqueId);
|
||||
}
|
||||
}
|
||||
@ -156,10 +156,6 @@ class InternalSider extends React.Component<InternalSideProps, SiderState> {
|
||||
this.setCollapsed(collapsed, 'clickTrigger');
|
||||
};
|
||||
|
||||
belowShowChange = () => {
|
||||
this.setState(({ belowShow }) => ({ belowShow: !belowShow }));
|
||||
};
|
||||
|
||||
renderSider = ({ getPrefixCls }: ConfigConsumerProps) => {
|
||||
const {
|
||||
prefixCls: customizePrefixCls,
|
||||
|
@ -12,6 +12,12 @@ describe('Layout', () => {
|
||||
mountTest(Layout);
|
||||
mountTest(Content);
|
||||
mountTest(Sider);
|
||||
mountTest(() => (
|
||||
<Layout>
|
||||
<Sider />
|
||||
<Content />
|
||||
</Layout>
|
||||
));
|
||||
|
||||
rtlTest(Layout);
|
||||
rtlTest(Content);
|
||||
@ -60,18 +66,8 @@ describe('Layout', () => {
|
||||
<Content>Content</Content>
|
||||
</Layout>,
|
||||
);
|
||||
expect(
|
||||
wrapper
|
||||
.find('.ant-layout-sider')
|
||||
.at(0)
|
||||
.prop('style').width,
|
||||
).toBe('50%');
|
||||
expect(
|
||||
wrapper
|
||||
.find('.ant-layout-sider')
|
||||
.at(0)
|
||||
.prop('style').flex,
|
||||
).toBe('0 0 50%');
|
||||
expect(wrapper.find('.ant-layout-sider').at(0).prop('style').width).toBe('50%');
|
||||
expect(wrapper.find('.ant-layout-sider').at(0).prop('style').flex).toBe('0 0 50%');
|
||||
});
|
||||
|
||||
it('detect ant-layout-sider-zero-width class in sider when its width is 0%', async () => {
|
||||
|
@ -61,22 +61,9 @@ const Typography: React.RefForwardingComponent<{}, InternalTypographyProps> = (
|
||||
);
|
||||
};
|
||||
|
||||
let RefTypography;
|
||||
const RefTypography = React.forwardRef(Typography);
|
||||
|
||||
if (React.forwardRef) {
|
||||
RefTypography = React.forwardRef(Typography);
|
||||
RefTypography.displayName = 'Typography';
|
||||
} else {
|
||||
class TypographyWrapper extends React.Component<TypographyProps, {}> {
|
||||
state = {};
|
||||
|
||||
render() {
|
||||
return <Typography {...this.props} />;
|
||||
}
|
||||
}
|
||||
|
||||
RefTypography = TypographyWrapper;
|
||||
}
|
||||
RefTypography.displayName = 'Typography';
|
||||
|
||||
// es default export should use const instead of let
|
||||
const ExportTypography = (RefTypography as unknown) as React.FC<TypographyProps>;
|
||||
|
Loading…
Reference in New Issue
Block a user