/** * Test helper utilities for context menu components * Extracts shared patterns from utils.test.js, ContextMenu.test.js, and menuItems.test.js */ /** * Creates a mock ProseMirror selection object with configurable properties */ export function createMockSelection(options?: {}): { from: number; to: number; empty: boolean; $head: { marks: import('vitest').Mock<() => { type: { name: never; }; }[]>; }; $from: { depth: number; node: import('vitest').Mock<() => { type: { name: string; }; }>; }; $to: { depth: number; node: import('vitest').Mock<() => { type: { name: string; }; }>; }; constructor: { near: import('vitest').Mock<() => { from: number; to: number; }>; }; }; /** * Creates a mock ProseMirror state object with configurable properties */ export function createMockState(options?: {}): { selection: { from: number; to: number; empty: boolean; $head: { marks: import('vitest').Mock<() => { type: { name: never; }; }[]>; }; $from: { depth: number; node: import('vitest').Mock<() => { type: { name: string; }; }>; }; $to: { depth: number; node: import('vitest').Mock<() => { type: { name: string; }; }>; }; constructor: { near: import('vitest').Mock<() => { from: number; to: number; }>; }; }; doc: { textBetween: import('vitest').Mock<() => string>; nodeAt: import('vitest').Mock<() => { type: { name: string; }; }>; resolve: import('vitest').Mock<() => {}>; }; schema: { marks: {}; nodes: { paragraph: { name: string; }; table: { name: string; }; bulletList: { name: string; }; documentSection: { name: string; }; }; }; storedMarks: null; history: { undoDepth: number; redoDepth: number; }; tr: { setMeta: import('vitest').Mock<() => any>; setSelection: import('vitest').Mock<() => any>; }; }; /** * Creates a mock ProseMirror view object with configurable properties */ export function createMockView(options?: {}): { state: { selection: { from: number; to: number; empty: boolean; $head: { marks: import('vitest').Mock<() => { type: { name: never; }; }[]>; }; $from: { depth: number; node: import('vitest').Mock<() => { type: { name: string; }; }>; }; $to: { depth: number; node: import('vitest').Mock<() => { type: { name: string; }; }>; }; constructor: { near: import('vitest').Mock<() => { from: number; to: number; }>; }; }; doc: { textBetween: import('vitest').Mock<() => string>; nodeAt: import('vitest').Mock<() => { type: { name: string; }; }>; resolve: import('vitest').Mock<() => {}>; }; schema: { marks: {}; nodes: { paragraph: { name: string; }; table: { name: string; }; bulletList: { name: string; }; documentSection: { name: string; }; }; }; storedMarks: null; history: { undoDepth: number; redoDepth: number; }; tr: { setMeta: import('vitest').Mock<() => any>; setSelection: import('vitest').Mock<() => any>; }; }; coordsAtPos: any; posAtCoords: any; dispatch: import('vitest').Mock<(...args: any[]) => any>; focus: import('vitest').Mock<(...args: any[]) => any>; dom: { addEventListener: import('vitest').Mock<(...args: any[]) => any>; removeEventListener: import('vitest').Mock<(...args: any[]) => any>; getBoundingClientRect: import('vitest').Mock<() => { left: number; top: number; }>; }; }; /** * Creates a mock editor object with configurable options */ export function createMockEditor(options?: {}): { view: { state: { selection: { from: number; to: number; empty: boolean; $head: { marks: import('vitest').Mock<() => { type: { name: never; }; }[]>; }; $from: { depth: number; node: import('vitest').Mock<() => { type: { name: string; }; }>; }; $to: { depth: number; node: import('vitest').Mock<() => { type: { name: string; }; }>; }; constructor: { near: import('vitest').Mock<() => { from: number; to: number; }>; }; }; doc: { textBetween: import('vitest').Mock<() => string>; nodeAt: import('vitest').Mock<() => { type: { name: string; }; }>; resolve: import('vitest').Mock<() => {}>; }; schema: { marks: {}; nodes: { paragraph: { name: string; }; table: { name: string; }; bulletList: { name: string; }; documentSection: { name: string; }; }; }; storedMarks: null; history: { undoDepth: number; redoDepth: number; }; tr: { setMeta: import('vitest').Mock<() => any>; setSelection: import('vitest').Mock<() => any>; }; }; coordsAtPos: any; posAtCoords: any; dispatch: import('vitest').Mock<(...args: any[]) => any>; focus: import('vitest').Mock<(...args: any[]) => any>; dom: { addEventListener: import('vitest').Mock<(...args: any[]) => any>; removeEventListener: import('vitest').Mock<(...args: any[]) => any>; getBoundingClientRect: import('vitest').Mock<() => { left: number; top: number; }>; }; }; state: { selection: { from: number; to: number; empty: boolean; $head: { marks: import('vitest').Mock<() => { type: { name: never; }; }[]>; }; $from: { depth: number; node: import('vitest').Mock<() => { type: { name: string; }; }>; }; $to: { depth: number; node: import('vitest').Mock<() => { type: { name: string; }; }>; }; constructor: { near: import('vitest').Mock<() => { from: number; to: number; }>; }; }; doc: { textBetween: import('vitest').Mock<() => string>; nodeAt: import('vitest').Mock<() => { type: { name: string; }; }>; resolve: import('vitest').Mock<() => {}>; }; schema: { marks: {}; nodes: { paragraph: { name: string; }; table: { name: string; }; bulletList: { name: string; }; documentSection: { name: string; }; }; }; storedMarks: null; history: { undoDepth: number; redoDepth: number; }; tr: { setMeta: import('vitest').Mock<() => any>; setSelection: import('vitest').Mock<() => any>; }; }; dispatch: import('vitest').Mock<(...args: any[]) => any>; focus: import('vitest').Mock<(...args: any[]) => any>; coordsAtPos: any; posAtCoords: any; presentationEditor: any; options: { documentMode: string; isAiEnabled: boolean; contextMenuConfig: null; aiApiKey: null; aiEndpoint: null; }; isEditable: boolean; commands: any; on: import('vitest').Mock<(...args: any[]) => any>; off: import('vitest').Mock<(...args: any[]) => any>; emit: import('vitest').Mock<(...args: any[]) => any>; }; /** * Creates a mock editor context object for context menu utilities */ export function createMockContext(options?: {}): { editor: any; cursorPosition: { x: number; y: number; }; pos: number; node: { type: { name: string; }; }; event: any; selectedText: string; hasSelection: boolean; trigger: string; clipboardContent: { html: null; text: null; hasContent: boolean; }; selectionStart: number; selectionEnd: number; isInTable: boolean; isInList: boolean; isInSectionNode: boolean; currentNodeType: string; activeMarks: never[]; isTrackedChange: boolean; trackedChanges: never[]; isCellSelection: boolean; tableSelectionKind: null; documentMode: string; canUndo: boolean; canRedo: boolean; isEditable: boolean; }; /** * Sets up common mocks and returns cleanup functions * Returns an object with mock functions and a cleanup function */ export function setupCommonMocks(): { mocks: { readFromClipboard: import('vitest').Mock<(...args: any[]) => any>; selectionHasNodeOrMark: import('vitest').Mock<() => boolean>; moveCursorToMouseEvent: import('vitest').Mock<(...args: any[]) => any>; handleClipboardPaste: import('vitest').Mock<() => boolean>; }; spies: { docAddEventListener: import('vitest').MockInstance<{ (type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; }>; docRemoveEventListener: import('vitest').MockInstance<{ (type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void; (type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; }>; }; cleanup: () => void; }; /** * Creates a beforeEach setup function with common mock resets * Has a callback for any custom setup that needs to be done before each test */ export function createBeforeEachSetup(customSetup?: () => void): () => void; /** * Mounts a Vue component with common props and returns wrapper with helper methods */ export function mountContextMenuComponent(component: any, options?: {}): { wrapper: import('@vue/test-utils').VueWrapper>>; props: any; openMenu(menuPosition?: { left: string; top: string; }): Promise; closeMenu(): Promise; triggerKeydown(key: any, target?: string): Promise; }; /** * Filters menu items by various criteria (helper for testing menu item filtering) */ export function filterMenuItems(sections: any, criteria?: {}): any; /** * Creates mock menu items for testing */ export function createMockMenuItems(count?: number, customItems?: any[]): { id: string; items: any[]; }[]; /** * Creates a mock item with custom render function for testing */ export function createMockRenderItem(id?: string, renderFn?: null): { id: string; label: string; render: import('vitest').Mock<() => HTMLDivElement>; showWhen: (context: any) => boolean; }; /** * Common assertions for editor mock objects */ export function assertEditorMockStructure(editor: any): void; /** * Common assertions for menu sections structure */ export function assertMenuSectionsStructure(sections: any): void; /** * Asserts that event listeners are properly set up */ export function assertEventListenersSetup(editor: any, documentSpies: any): void; /** * Asserts that event listeners are properly cleaned up */ export function assertEventListenersCleanup(editor: any, documentSpies: any): void; export namespace ContextMenuConfigs { namespace withAI { let includeDefaultItems: boolean; let customItems: never[]; } namespace customOnly { let includeDefaultItems_1: boolean; export { includeDefaultItems_1 as includeDefaultItems }; let customItems_1: { id: string; items: { id: string; label: string; showWhen: (context: any) => boolean; action: import("vitest").Mock<(...args: any[]) => any>; }[]; }[]; export { customItems_1 as customItems }; } function withProvider(providerFn: any): { includeDefaultItems: boolean; menuProvider: any; }; namespace withConditionalItems { let includeDefaultItems_2: boolean; export { includeDefaultItems_2 as includeDefaultItems }; let customItems_2: { id: string; items: { id: string; label: string; showWhen: (context: any) => any; action: import("vitest").Mock<(...args: any[]) => any>; }[]; }[]; export { customItems_2 as customItems }; } } //# sourceMappingURL=testHelpers.d.ts.map