feat: add preloading template

This commit is contained in:
Flrande
2023-06-07 17:31:54 +08:00
committed by himself65
parent ead106b940
commit e6cd2ace7d
67 changed files with 6732 additions and 385 deletions

View File

@@ -3,7 +3,7 @@
*/
import 'fake-indexeddb/auto';
import { initPage } from '@affine/env/blocksuite';
import { initEmptyPage } from '@affine/env/blocksuite';
import { __unstableSchemas, AffineSchemas } from '@blocksuite/blocks/models';
import { Workspace } from '@blocksuite/store';
import { renderHook } from '@testing-library/react';
@@ -20,9 +20,9 @@ beforeEach(() => {
})
.register(AffineSchemas)
.register(__unstableSchemas);
initPage(blockSuiteWorkspace.createPage({ id: 'page0' }));
initPage(blockSuiteWorkspace.createPage({ id: 'page1' }));
initPage(blockSuiteWorkspace.createPage({ id: 'page2' }));
initEmptyPage(blockSuiteWorkspace.createPage({ id: 'page0' }));
initEmptyPage(blockSuiteWorkspace.createPage({ id: 'page1' }));
initEmptyPage(blockSuiteWorkspace.createPage({ id: 'page2' }));
});
describe('useBlockSuiteWorkspaceHelper', () => {
@@ -50,7 +50,7 @@ describe('useBlockSuiteWorkspaceHelper', () => {
);
await helperHook.result.current.markMilestone('test');
expect(blockSuiteWorkspace.meta.pageMetas.length).toBe(3);
initPage(helperHook.result.current.createPage('page4'));
initEmptyPage(helperHook.result.current.createPage('page4'));
expect(blockSuiteWorkspace.meta.pageMetas.length).toBe(4);
expect(await helperHook.result.current.listMilestone()).toHaveProperty(
'test'

View File

@@ -16,8 +16,6 @@ declare module '@blocksuite/store' {
updatedDate?: number;
mode?: 'page' | 'edgeless';
jumpOnce?: boolean;
// whether to create the page with the default template
init?: boolean;
// todo: support `number` in the future
isPublic?: boolean;
}