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
This commit is contained in:
MinJeong Kim 2018-02-24 11:35:04 +09:00 committed by 偏右
parent f1fd85780e
commit feaf238dfa
3 changed files with 12 additions and 2 deletions

View File

@ -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',
});

View File

@ -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

View File

@ -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);
});
});