diff --git a/.dumi/theme/slots/Content/index.tsx b/.dumi/theme/slots/Content/index.tsx index 1ecddfd0be..78d6bfc027 100644 --- a/.dumi/theme/slots/Content/index.tsx +++ b/.dumi/theme/slots/Content/index.tsx @@ -187,7 +187,7 @@ const Content: React.FC<{ children: ReactNode }> = ({ children }) => {
- {meta.frontmatter?.title && meta.frontmatter.subtitle ? ( + {meta.frontmatter?.title ? ( {meta.frontmatter?.title} {meta.frontmatter.subtitle && ( diff --git a/scripts/check-site.js b/scripts/check-site.js index 31217a3bd2..b5943c34d2 100755 --- a/scripts/check-site.js +++ b/scripts/check-site.js @@ -9,8 +9,7 @@ const { createServer } = require('http-server'); const components = uniq( glob - .sync('components/*/*.md', { - ignore: '**/{__tests__,_util,version,index.tsx}', + .sync('components/!(overview)/*.md', { cwd: join(process.cwd()), dot: false, }) @@ -35,13 +34,13 @@ describe('site test', () => { const handleComponentName = (name) => { const componentName = name.split('/')[1]; - return componentName.toLowerCase().replace('-', ''); + return componentName.toLowerCase().replace('-cn', '').replace('-', ''); }; const expectComponent = async (component) => { const { status, $ } = await render(`/${component}/`); expect(status).toBe(200); - expect($('main h1').text().toLowerCase()).toMatch(handleComponentName(component)); + expect($('h1').text().toLowerCase()).toMatch(handleComponentName(component)); }; beforeAll(() => { @@ -73,10 +72,22 @@ describe('site test', () => { expect(status).toBe(200); }); + it('Overview en', async () => { + const { status, $ } = await render('/components/overview'); + expect(status).toBe(200); + expect($('h1').text()).toMatch(`Overview`); + }); + + it('Overview zh', async () => { + const { status, $ } = await render('/components/overview-cn'); + expect(status).toBe(200); + expect($('h1').text()).toMatch(`组件总览`); + }); + for (const component of components) { if (component.split('/').length < 3) { it(`Component ${component} zh Page`, async () => { - await expectComponent(component); + await expectComponent(`${component}-cn`); }); it(`Component ${component} en Page`, async () => {