diff --git a/src/SiderMenu/SiderMenu.tsx b/src/SiderMenu/SiderMenu.tsx index 89d5c0e4..d5d855b7 100644 --- a/src/SiderMenu/SiderMenu.tsx +++ b/src/SiderMenu/SiderMenu.tsx @@ -110,8 +110,10 @@ const SiderMenu: React.FC = (props) => { }); const headerDom = defaultRenderLogoAndTitle(props); + const extraDom = menuExtraRender && menuExtraRender(props); - const menuDom = flatMenuKeys && ( + + const menuDom = menuContentRender !== false && flatMenuKeys && ( { it('🥩 do not render menu', async () => { const wrapper = mount(); await waitForComponentToPaint(wrapper); - const menu = wrapper.find('.ant-pro-sider-menu'); + const menu = wrapper.find('.ant-pro-sider'); expect(menu.exists()).toBe(false); + const menuContent = wrapper.find('.ant-pro-sider-menu'); + expect(menuContent.exists()).toBe(false); expect( ( wrapper.find('section.ant-layout section.ant-layout').props().style || @@ -40,6 +42,16 @@ describe('BasicLayout', () => { wrapper.unmount(); }); + it('🥩 do not render menu content', async () => { + const wrapper = mount(); + await waitForComponentToPaint(wrapper); + const menu = wrapper.find('.ant-pro-sider'); + expect(menu.exists()).toBe(true); + const menuContent = wrapper.find('.ant-pro-sider-menu'); + expect(menuContent.exists()).toBe(false); + wrapper.unmount(); + }); + it('🥩 support menuDateRender', async () => { const wrapper = mount( { '100%', ); }); + + it('🐲 FooterToolbar should know width', async () => { + const wrapper = mount( + + + + + + + , + ); + await waitForComponentToPaint(wrapper); + + expect(wrapper.find('.ant-pro-footer-bar').props().style.width).toBe( + 'calc(100% - 208px)', + ); + wrapper.setProps({ + collapsed: true, + }); + + await waitForComponentToPaint(wrapper); + + expect(wrapper.find('.ant-pro-footer-bar').props().style.width).toBe( + 'calc(100% - 48px)', + ); + + wrapper.setProps({ + layout: 'top', + }); + + expect(wrapper.find('.ant-pro-footer-bar').props().style.width).toBe( + '100%', + ); + }); }); diff --git a/tsconfig.json b/tsconfig.json index d87a7f97..b25a8269 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -21,6 +21,7 @@ "@ant-design/pro-layout": ["./src"] } }, + "include": ["**/tests/", "**/src/", "**/docs/"], "exclude": [ "node_modules", "build", @@ -30,8 +31,6 @@ "jest", "tslint:latest", "tslint-config-prettier", - "example", - "_test_", - "tests" + "example" ] }