UNPKG

claritykit-svelte

Version:

A comprehensive Svelte component library focused on accessibility, ADHD-optimized design, developer experience, and full SSR compatibility

125 lines 3.96 kB
/** * Editor test utilities for TipTap/ProseMirror components * Provides factory functions and test helpers for editor testing */ /** * Mock Editor class that mimics TipTap Editor behavior */ export declare class MockEditor { element: HTMLElement; extensions: any[]; content: string; editable: boolean; private callbacks; constructor(config?: any); private _initializeDOMStructure; getHTML(): string; getJSON(): any; getText(): string; setEditable(editable: boolean): void; isActive(name: string): boolean; chain(): { focus(): /*elided*/ any; toggleBold(): /*elided*/ any; toggleItalic(): /*elided*/ any; run(): boolean; }; get commands(): { setContent: (content: string) => boolean; focus: () => boolean; blur: () => boolean; }; destroy(): void; focus(): void; blur(): void; private _triggerCallback; simulateTyping(text: string): void; simulateFocus(): void; simulateBlur(): void; } /** * Editor factory for creating consistent test setups */ export declare class EditorTestFactory { private static mocks; /** * Sets up the test environment for editor testing */ static setup(): { cleanup: () => void; localStorage: { getItem: import("vitest").Mock<(...args: any[]) => any>; setItem: import("vitest").Mock<(...args: any[]) => any>; removeItem: import("vitest").Mock<(...args: any[]) => any>; clear: import("vitest").Mock<(...args: any[]) => any>; key: import("vitest").Mock<(...args: any[]) => any>; length: number; }; sessionStorage: { getItem: import("vitest").Mock<(...args: any[]) => any>; setItem: import("vitest").Mock<(...args: any[]) => any>; removeItem: import("vitest").Mock<(...args: any[]) => any>; clear: import("vitest").Mock<(...args: any[]) => any>; key: import("vitest").Mock<(...args: any[]) => any>; length: number; }; matchMedia: import("vitest").Mock<(...args: any[]) => any>; getComputedStyle: import("vitest").Mock<(...args: any[]) => any>; ResizeObserver: import("vitest").Mock<(...args: any[]) => any>; IntersectionObserver: import("vitest").Mock<(...args: any[]) => any>; }; /** * Creates a mock editor instance */ static createEditor(config?: any): MockEditor; /** * Creates a mock editor element ready for mounting */ static createEditorElement(): HTMLDivElement; /** * Creates mock editor configuration */ static createEditorConfig(overrides?: any): any; /** * Mock the TipTap Editor constructor */ static mockTipTapEditor(): import("vitest").Mock<(...args: any[]) => any>; /** * Creates a test helper for editor components */ static createTestHelper(): { /** * Simulates text input in an editor */ simulateTextInput: (element: HTMLElement, text: string) => void; /** * Simulates a key press in an editor */ simulateKeyPress: (element: HTMLElement, key: string, options?: any) => void; /** * Simulates focus on an editor element */ simulateFocus: (element: HTMLElement) => void; /** * Simulates blur on an editor element */ simulateBlur: (element: HTMLElement) => void; /** * Waits for editor to be ready */ waitForEditor: () => Promise<void>; /** * Cleans up editor mocks */ cleanup: () => void; }; /** * Cleans up all editor mocks */ static cleanup(): void; } /** * Default export for convenience */ export declare const editorTestUtils: typeof EditorTestFactory; //# sourceMappingURL=editor-test-utils.d.ts.map