test: add test case for blocksuite editor (#1528)

This commit is contained in:
Himself65
2023-03-10 17:45:10 -06:00
committed by GitHub
parent 1c89841d6f
commit a795000363
19 changed files with 495 additions and 488 deletions

View File

@@ -0,0 +1,41 @@
import { NoSsr } from '@mui/material';
import dynamic from 'next/dynamic';
import { useRouter } from 'next/router';
import { StyledPage, StyledWrapper } from '../../layouts/styles';
import { NextPageWithLayout } from '../../shared';
import { initPage } from '../../utils/blocksuite';
const Editor = dynamic(
() => import('../../components/__debug__/client/Editor'),
{
ssr: false,
}
);
const InitPagePage: NextPageWithLayout = () => {
const router = useRouter();
if (!router.isReady) {
return <>loading...</>;
}
let testType: 'empty' | 'importMarkdown' = 'empty';
if (router.query.type === 'importMarkdown') {
testType = 'importMarkdown';
} else if (router.query.type === 'empty') {
testType = 'empty';
}
return (
<StyledPage>
<StyledWrapper>
<Editor onInit={initPage} testType={testType} />
<div id="toolWrapper" />
</StyledWrapper>
</StyledPage>
);
};
export default InitPagePage;
InitPagePage.getLayout = page => {
return <NoSsr>{page}</NoSsr>;
};