/** * @file * * Mock of Obsidian's `MomentFormatComponent`, a text input for a moment.js date format with a live sample. */ import type { MomentFormatComponent as MomentFormatComponentOriginal } from 'obsidian'; import { TextComponent } from './TextComponent.mjs'; /** * Mock of Obsidian's `MomentFormatComponent`, a text input whose value is a moment.js format string. * * The sample preview is never rendered: {@link MomentFormatComponent.updateSample} is a no-op, and the default * format is only recorded in {@link MomentFormatComponent.defaultFormat__}. */ export declare class MomentFormatComponent extends TextComponent { /** * Mock-only: the default format last passed to {@link MomentFormatComponent.setDefaultFormat} (`''` until then). */ defaultFormat__: string; /** * The element Obsidian renders the formatted sample date into. */ sampleEl: HTMLElement; /** * Creates the format input inside `containerEl`, with a fresh sample element appended to it. * * @param containerEl - The element to create the component in. */ constructor(containerEl: HTMLElement); /** * Mock-only factory: creates a moment format component, spyable via `vi.spyOn(MomentFormatComponent, 'create2__')`. * It is the subclass variant of `TextComponent`'s factory. * * @param containerEl - The element to create the component in. * @returns The new moment format component. */ static create2__(containerEl: HTMLElement): MomentFormatComponent; /** * Mock-only: views a value typed as Obsidian's `MomentFormatComponent` as this mock. * * @param value - The value typed as the original `MomentFormatComponent`. * @returns The same object, typed as the mock. */ static fromOriginalType5__(value: MomentFormatComponentOriginal): MomentFormatComponent; /** * Mock-only: views this mock as Obsidian's `MomentFormatComponent` type. * * @returns The same object, typed as the original `MomentFormatComponent`. */ asOriginalType5__(): MomentFormatComponentOriginal; /** * Mock-only construction hook, called at the end of the constructor; a no-op meant for * `vi.spyOn(MomentFormatComponent.prototype, 'constructor5__')`. * * @param _containerEl - The element the component was created in. */ constructor5__(_containerEl: HTMLElement): void; /** * Sets the format used when the input is cleared, which Obsidian also shows as the placeholder. The mock only * records it in {@link MomentFormatComponent.defaultFormat__}. * * @param defaultFormat - The default moment.js format string. * @returns This component, for chaining. */ setDefaultFormat(defaultFormat: string): this; /** * Replaces the element the formatted sample is rendered into. * * @param sampleEl - The new sample element. * @returns This component, for chaining. */ setSampleEl(sampleEl: HTMLElement): this; /** * Sets the format string in the input, delegating to `TextComponent.setValue`. * * @param value - The moment.js format string. * @returns This component, for chaining. */ setValue(value: string): this; /** * Re-renders the sample date in the current format. A no-op in the mock, which renders no sample. */ updateSample(): void; }