From feaf238dfa4250444a5c1dfbd51d3c884db1958d Mon Sep 17 00:00:00 2001 From: MinJeong Kim Date: Sat, 24 Feb 2018 11:35:04 +0900 Subject: [PATCH] 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 --- components/layout/Sider.tsx | 2 +- .../layout/__tests__/__snapshots__/demo.test.js.snap | 2 +- components/layout/__tests__/index.test.js | 10 ++++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/components/layout/Sider.tsx b/components/layout/Sider.tsx index 90257e5816..d7765a8f31 100644 --- a/components/layout/Sider.tsx +++ b/components/layout/Sider.tsx @@ -212,7 +212,7 @@ export default class Sider extends React.Component { }; 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', }); diff --git a/components/layout/__tests__/__snapshots__/demo.test.js.snap b/components/layout/__tests__/__snapshots__/demo.test.js.snap index d0b5332f92..f424ce533b 100644 --- a/components/layout/__tests__/__snapshots__/demo.test.js.snap +++ b/components/layout/__tests__/__snapshots__/demo.test.js.snap @@ -688,7 +688,7 @@ exports[`renders ./components/layout/demo/side.md correctly 1`] = ` style="min-height:100vh" >
{ ); 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( + +
Sider
+ Content +
+ ); + expect(wrapper.find('.ant-layout-sider').hasClass('ant-layout-sider-has-trigger')).toBe(true); + }); });