Skip to content

Commit

Permalink
test: Add test case for SettingDrawer
Browse files Browse the repository at this point in the history
  • Loading branch information
Junyi committed Jan 6, 2025
1 parent bc33f8c commit 345826e
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/layout/settingDrawer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -496,4 +496,33 @@ describe('settingDrawer.test', () => {

window.localStorage.setItem('umi_locale', 'zh-CN');
});

it('🌺 drawerProps = undefined', async () => {
const html = render(
<SettingDrawer
disableUrlParams
collapse
getContainer={false}
drawerProps={undefined as any}
/>,
);

expect(html.asFragment()).toMatchSnapshot();
});

it('🌺 drawerProps has extra', async () => {
const { container } = render(
<SettingDrawer
disableUrlParams
collapse
getContainer={false}
drawerProps={{
closable: true,
extra: 'extra'
}}
/>,
);

expect(container.querySelectorAll('div.ant-drawer-extra')[0].innerHTML).toEqual('extra');
});
});

0 comments on commit 345826e

Please sign in to comment.