fix: set `-has-trigger` class in sider when `-trigger` div exists (#9399)

* fix: set `-has-trigger` class in sider when `-trigger` div exists

* fix: fix template expr lint error
pull/9353/merge
MinJeong Kim 7 years ago committed by 偏右
parent f1fd85780e
commit feaf238dfa

@ -212,7 +212,7 @@ export default class Sider extends React.Component<SiderProps, SliderState> {
};
const siderCls = classNames(className, prefixCls, {
[`${prefixCls}-collapsed`]: !!this.state.collapsed,
[`${prefixCls}-has-trigger`]: !!trigger,
[`${prefixCls}-has-trigger`]: collapsible && trigger !== null && !zeroWidthTrigger,
[`${prefixCls}-below`]: !!this.state.below,
[`${prefixCls}-zero-width`]: siderWidth === 0 || siderWidth === '0' || siderWidth === '0px',
});

@ -688,7 +688,7 @@ exports[`renders ./components/layout/demo/side.md correctly 1`] = `
style="min-height:100vh"
>
<div
class="ant-layout-sider"
class="ant-layout-sider ant-layout-sider-has-trigger"
style="flex:0 0 200px;max-width:200px;min-width:200px;width:200px"
>
<div

@ -24,4 +24,14 @@ describe('Layout', () => {
);
expect(wrapper.find('.ant-layout').hasClass('ant-layout-has-sider')).toBe(true);
});
it('detect ant-layout-sider-has-trigger class in sider when ant-layout-sider-trigger div tag exists', async () => {
const wrapper = mount(
<Layout>
<div><Sider collapsible>Sider</Sider></div>
<Content>Content</Content>
</Layout>
);
expect(wrapper.find('.ant-layout-sider').hasClass('ant-layout-sider-has-trigger')).toBe(true);
});
});

Loading…
Cancel
Save