refactor(editor): rename presets to integration test (#10340)

This commit is contained in:
Saul-Mirone
2025-02-21 06:26:03 +00:00
parent f79324b6a1
commit f3218ab3bc
116 changed files with 156 additions and 210 deletions
@@ -15,7 +15,7 @@ import {
titleMiddleware,
} from '@blocksuite/blocks';
import { WithDisposable } from '@blocksuite/global/utils';
import type { AffineEditorContainer } from '@blocksuite/presets';
import type { TestAffineEditorContainer } from '@blocksuite/integration-test';
import { type DocSnapshot, Transformer } from '@blocksuite/store';
import { effect } from '@preact/signals-core';
import type SlTabPanel from '@shoelace-style/shoelace/dist/components/tab-panel/tab-panel.js';
@@ -284,7 +284,7 @@ export class AdaptersPanel extends WithDisposable(ShadowlessElement) {
private accessor _plainTextContent = '';
@property({ attribute: false })
accessor editor!: AffineEditorContainer;
accessor editor!: TestAffineEditorContainer;
}
declare global {
@@ -1,6 +1,6 @@
import { ShadowlessElement } from '@blocksuite/block-std';
import { WithDisposable } from '@blocksuite/global/utils';
import type { AffineEditorContainer } from '@blocksuite/presets';
import type { TestAffineEditorContainer } from '@blocksuite/integration-test';
import { effect } from '@preact/signals-core';
import { css, html, nothing } from 'lit';
import { customElement, property, state } from 'lit/decorators.js';
@@ -59,7 +59,7 @@ export class CustomFramePanel extends WithDisposable(ShadowlessElement) {
private accessor _show = false;
@property({ attribute: false })
accessor editor!: AffineEditorContainer;
accessor editor!: TestAffineEditorContainer;
}
declare global {
@@ -1,6 +1,6 @@
import { ShadowlessElement } from '@blocksuite/block-std';
import { WithDisposable } from '@blocksuite/global/utils';
import type { AffineEditorContainer } from '@blocksuite/presets';
import type { TestAffineEditorContainer } from '@blocksuite/integration-test';
import { css, html, nothing } from 'lit';
import { customElement, property, state } from 'lit/decorators.js';
@@ -45,7 +45,7 @@ export class CustomOutlinePanel extends WithDisposable(ShadowlessElement) {
private accessor _show = false;
@property({ attribute: false })
accessor editor!: AffineEditorContainer;
accessor editor!: TestAffineEditorContainer;
}
declare global {
@@ -1,5 +1,5 @@
import { WithDisposable } from '@blocksuite/global/utils';
import type { AffineEditorContainer } from '@blocksuite/presets';
import type { TestAffineEditorContainer } from '@blocksuite/integration-test';
import { css, html, LitElement, nothing } from 'lit';
import { customElement, property, state } from 'lit/decorators.js';
@@ -38,7 +38,7 @@ export class CustomOutlineViewer extends WithDisposable(LitElement) {
private accessor _show = false;
@property({ attribute: false })
accessor editor!: AffineEditorContainer;
accessor editor!: TestAffineEditorContainer;
@property({ attribute: false })
accessor toggleOutlinePanel: (() => void) | null = null;
@@ -5,7 +5,7 @@ import {
GenerateDocUrlProvider,
} from '@blocksuite/blocks';
import { WithDisposable } from '@blocksuite/global/utils';
import type { AffineEditorContainer } from '@blocksuite/presets';
import type { TestAffineEditorContainer } from '@blocksuite/integration-test';
import type { Doc, Workspace } from '@blocksuite/store';
import { css, html, nothing } from 'lit';
import { customElement, property } from 'lit/decorators.js';
@@ -163,7 +163,7 @@ export class DocsPanel extends WithDisposable(ShadowlessElement) {
}
@property({ attribute: false })
accessor editor!: AffineEditorContainer;
accessor editor!: TestAffineEditorContainer;
@property({ attribute: false })
accessor onClose!: () => void;
@@ -48,7 +48,7 @@ import {
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
import type { SerializedXYWH } from '@blocksuite/global/utils';
import type { DeltaInsert } from '@blocksuite/inline/types';
import { AffineEditorContainer, type CommentPanel } from '@blocksuite/presets';
import { TestAffineEditorContainer } from '@blocksuite/integration-test';
import { Text, Transformer, type Workspace } from '@blocksuite/store';
import type { SlDropdown } from '@shoelace-style/shoelace';
import { setBasePath } from '@shoelace-style/shoelace/dist/utilities/base-path.js';
@@ -57,6 +57,7 @@ import { customElement, property, query, state } from 'lit/decorators.js';
import * as lz from 'lz-string';
import type { Pane } from 'tweakpane';
import type { CommentPanel } from '../../comment/index.js';
import { createTestEditor } from '../../starter/utils/extensions.js';
import { mockEdgelessTheme } from '../mock-services.js';
import { AdaptersPanel } from './adapters-panel.js';
@@ -647,7 +648,7 @@ export class StarterDebugMenu extends ShadowlessElement {
const newEditor = createTestEditor(this.doc, this.collection);
app.append(newEditor);
app.childNodes.forEach(child => {
if (child instanceof AffineEditorContainer) {
if (child instanceof TestAffineEditorContainer) {
child.style.flex = '1';
}
});
@@ -1014,7 +1015,7 @@ export class StarterDebugMenu extends ShadowlessElement {
accessor docsPanel!: DocsPanel;
@property({ attribute: false })
accessor editor!: AffineEditorContainer;
accessor editor!: TestAffineEditorContainer;
@property({ attribute: false })
accessor framePanel!: CustomFramePanel;
@@ -1,6 +1,6 @@
import type { DocModeProvider } from '@blocksuite/blocks';
import { assertExists } from '@blocksuite/global/utils';
import type { AffineEditorContainer } from '@blocksuite/presets';
import type { TestAffineEditorContainer } from '@blocksuite/integration-test';
import type { Doc, Store, Workspace } from '@blocksuite/store';
export function getDocFromUrlParams(collection: Workspace, url: URL) {
@@ -40,7 +40,7 @@ export function setDocModeFromUrlParams(
export function listenHashChange(
collection: Workspace,
editor: AffineEditorContainer
editor: TestAffineEditorContainer
) {
const panel = document.querySelector('docs-panel');
window.addEventListener('hashchange', () => {
@@ -12,7 +12,7 @@ import {
toast,
} from '@blocksuite/blocks';
import { Slot } from '@blocksuite/global/utils';
import type { AffineEditorContainer } from '@blocksuite/presets';
import type { TestAffineEditorContainer } from '@blocksuite/integration-test';
import { type Workspace } from '@blocksuite/store';
import { Signal, signal } from '@preact/signals-core';
@@ -37,7 +37,7 @@ export function removeModeFromStorage(docId: string) {
const DEFAULT_MODE: DocMode = 'page';
const slotMap = new Map<string, Slot<DocMode>>();
export function mockDocModeService(editor: AffineEditorContainer) {
export function mockDocModeService(editor: TestAffineEditorContainer) {
const getEditorModeCallback: () => DocMode = () => editor.mode;
const setEditorModeCallback: (mode: DocMode) => void = mode =>
editor.switchEditor(mode);
@@ -78,7 +78,7 @@ export function mockDocModeService(editor: AffineEditorContainer) {
return docModeService;
}
export function mockNotificationService(editor: AffineEditorContainer) {
export function mockNotificationService(editor: TestAffineEditorContainer) {
const notificationService: NotificationService = {
toast: (message, options) => {
toast(editor.host!, message, options?.duration);