diff --git a/packages/layout/src/components/SettingDrawer/index.tsx b/packages/layout/src/components/SettingDrawer/index.tsx index 03c2f3aa614c..0bd722845fe0 100644 --- a/packages/layout/src/components/SettingDrawer/index.tsx +++ b/packages/layout/src/components/SettingDrawer/index.tsx @@ -17,6 +17,7 @@ import { Button, Divider, Drawer, + DrawerProps, List, Switch, message, @@ -79,6 +80,7 @@ export type SettingDrawerProps = { pathname?: string; disableUrlParams?: boolean; themeOnly?: boolean; + drawerProps?: DrawerProps; }; export type SettingDrawerState = { @@ -219,6 +221,7 @@ export const SettingDrawer: React.FC = (props) => { pathname = window.location.pathname, disableUrlParams = true, themeOnly, + drawerProps, } = props; const firstRender = useRef(true); @@ -386,6 +389,7 @@ export const SettingDrawer: React.FC = (props) => { style={{ zIndex: 999, }} + {...drawerProps} >
{ window.localStorage.setItem('umi_locale', 'zh-CN'); }); + + it('🌺 drawerProps = undefined', async () => { + const html = render( + , + ); + + expect(html.asFragment()).toMatchSnapshot(); + }); + + it('🌺 drawerProps has extra', async () => { + const { container } = render( + , + ); + + expect(container.querySelectorAll('div.ant-drawer-extra')[0].innerHTML).toEqual('extra'); + }); });