/** * @file * * Mock of Obsidian's `Notice`, the transient notification toast. */ import type { Notice as NoticeOriginal } from 'obsidian'; /** * Mock of Obsidian's `Notice` notification component. * * Nothing is shown on screen: the message is rendered into detached elements, so a test can read it back from * {@link Notice.messageEl}, and the requested duration is kept in {@link Notice.duration__}. */ export declare class Notice { /** * The notice's outer container element. */ containerEl: HTMLElement; /** * Mock-only: the duration, in milliseconds, the notice hides after. An omitted duration records Obsidian's * default, `4000`; `0` is recorded only when passed, and means the notice stays until dismissed. */ readonly duration__: number; /** * The element holding the notice's message. */ messageEl: HTMLElement; /** * The notice element. Obsidian deprecates it in favor of {@link Notice.messageEl}. */ noticeEl: HTMLElement; /** * Creates a notice and renders its message. * * @param message - The message to display, as text or as a fragment (which is cloned). * @param duration - Time in milliseconds to show the notice for; `0` keeps it until dismissed, and omitted means * Obsidian's default of `4000`. */ constructor(message: DocumentFragment | string, duration?: number); /** * Mock-only factory: creates a notice, spyable via `vi.spyOn(Notice, 'create__')`. * * @param message - The message to display. * @param duration - Time in milliseconds to show the notice for. * @returns The new notice. */ static create__(message: DocumentFragment | string, duration?: number): Notice; /** * Mock-only: views a value typed as Obsidian's `Notice` as this mock. * * @param value - The value typed as the original `Notice`. * @returns The same object, typed as the mock. */ static fromOriginalType__(value: NoticeOriginal): Notice; /** * Mock-only: views this mock as Obsidian's `Notice` type. * * @returns The same object, typed as the original `Notice`. */ asOriginalType__(): NoticeOriginal; /** * Mock-only construction hook, called at the end of the constructor; a no-op meant for * `vi.spyOn(Notice.prototype, 'constructor__')`. * * @param _message - The message the notice was created with. * @param _duration - The duration the notice was created with. */ constructor__(_message: DocumentFragment | string, _duration?: number): void; /** * Hides the notice. A no-op in the mock, since nothing is shown. */ hide(): void; /** * Replaces the notice's message. * * @param message - The new message, as text or as a fragment (which is cloned). * @returns This notice, for chaining. */ setMessage(message: DocumentFragment | string): this; }