diff --git a/packages/theme-default/src/layout.tsx b/packages/theme-default/src/layout.tsx index fe62b06216..16754b8c81 100644 --- a/packages/theme-default/src/layout.tsx +++ b/packages/theme-default/src/layout.tsx @@ -27,13 +27,13 @@ const Features = features => (
{features.map(feat => (
- { - feat.link - ? -
{feat.title}
- - :
{feat.title}
- } + {feat.link ? ( + +
{feat.title}
+ + ) : ( +
{feat.title}
+ )}
))} @@ -72,7 +72,10 @@ const Layout: React.FC = ({ children, location }) => { data-show-slugs={String(showSlugs)} data-site-mode={isSiteMode} data-gapless={String(!!meta.gapless)} - onClick={() => setMenuCollapsed(true)} + onClick={() => { + if (menuCollapsed) return; + setMenuCollapsed(true); + }} > { desc: 'Hero Description', actions: [{ text: '开始', link: '/' }], }, - features: [{ title: 'Feat', desc: 'Feature' }, { title: 'Feat2', link: '/' }] + features: [ + { title: 'Feat', desc: 'Feature' }, + { title: 'Feat2', link: '/' }, + ], }, }} > @@ -191,6 +194,9 @@ describe('default theme', () => { <> + + click + Alert Badge @@ -247,6 +253,23 @@ describe('default theme', () => { { wrapper }, ); + // toggle side menu display + fireEvent( + container.querySelector('.__dumi-default-navbar-toggle'), + new MouseEvent('click', { + bubbles: true, + cancelable: true, + }), + ); + + fireEvent( + container.querySelector('#btn'), + new MouseEvent('click', { + bubbles: true, + cancelable: true, + }), + ); + // expect SourceCode highlight expect(getByText('console')).toHaveClass('token');