Skip to content

Commit

Permalink
fix(layout): collapsed use vertical mode
Browse files Browse the repository at this point in the history
close #7518
  • Loading branch information
chenshuai2144 committed Aug 13, 2023
1 parent e677e32 commit e82170f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion packages/layout/src/components/SiderMenu/SiderMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ const SiderMenu: React.FC<SiderMenuProps & PrivateSiderMenuProps> = (props) => {
<BaseMenu
{...props}
key="base-menu"
mode="inline"
mode={collapsed && !isMobile ? 'vertical' : 'inline'}
handleOpenChange={onOpenChange}
style={{
width: '100%',
Expand Down
22 changes: 9 additions & 13 deletions tests/demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ function demoTest(component: string, options: Options = {}) {

const App = (props: { children: any; onInit: () => void }) => {
useEffect(() => {
props.onInit?.();
setTimeout(() => {
props.onInit?.();
}, 1000);
}, []);
return (
<>
Expand Down Expand Up @@ -109,23 +111,17 @@ function demoTest(component: string, options: Options = {}) {
jest.runAllTimers();
});

await waitFor(
() => {
return wrapper.findAllByText('test');
},
{ timeout: 3000 },
);
await waitFor(() => {
return wrapper.findAllByText('test');
});

act(() => {
jest.runAllTimers();
});

await waitFor(
() => {
return wrapper.findAllByText('test');
},
{ timeout: 3000 },
);
await waitFor(() => {
return wrapper.findAllByText('test');
});

await waitFor(() => {
expect(fn).toBeCalled();
Expand Down

0 comments on commit e82170f

Please sign in to comment.