TextAreaComponent
Mock of Obsidian’s TextAreaComponent: a text component backed by a <textarea>.
Import:
import { TextAreaComponent } from 'obsidian-test-mocks/obsidian';Signature:
export class TextAreaComponent extends AbstractTextComponent<HTMLTextAreaElement>Extends: AbstractTextComponent<HTMLTextAreaElement>
Constructor
new TextAreaComponent(containerEl: HTMLElement)Creates a text area and appends its <textarea> to the container.
Properties
| Property | Type | Description |
|---|---|---|
| changeCallback? | (value: string) => unknown | The callback registered with AbstractTextComponent.onChange, if any. (Inherited from AbstractTextComponent) |
| inputEl | HTMLTextAreaElement | The wrapped <input> or <textarea> element.(Inherited from AbstractTextComponent) |
Methods
| Method | Returns | Description |
|---|---|---|
| asOriginalType2__() | ValueComponentOriginal<string> | Mock-only: views this mock as Obsidian's ValueComponent type.(Inherited from AbstractTextComponent) |
| asOriginalType3__() | AbstractTextComponentOriginal<HTMLTextAreaElement> | Mock-only: views this mock as Obsidian's AbstractTextComponent type.(Inherited from AbstractTextComponent) |
| asOriginalType4__() | TextAreaComponentOriginal | Mock-only: views this mock as Obsidian's TextAreaComponent type. |
| constructor2__() | void | Mock-only construction hook, called at the end of the constructor; a no-op meant for vi.spyOn(ValueComponent.prototype, 'constructor2__').(Inherited from AbstractTextComponent) |
| constructor3__(_inputEl) | void | Mock-only construction hook, called at the end of the constructor; a no-op meant for vi.spyOn(AbstractTextComponent.prototype, 'constructor3__').(Inherited from AbstractTextComponent) |
| constructor4__(_containerEl) | void | Mock-only construction hook, called at the end of the constructor; a no-op meant for vi.spyOn(TextAreaComponent.prototype, 'constructor4__'). |
| getValue() | string | Gets the component's value. (Inherited from AbstractTextComponent) |
| onChange(callback) | this | Registers the callback to call when the user edits the value, replacing any earlier one. (Inherited from AbstractTextComponent) |
| onChanged() | void | Calls the change callback with the element's current value. The element's input listener calls it.(Inherited from AbstractTextComponent) |
| registerOptionListener(_listeners, _key) | this | Registers a listener under key that sets the component's value when called with one and returns the current value. A no-op in the mock, which registers nothing.(Inherited from AbstractTextComponent) |
| setDisabled(disabled) | this | Enables or disables the component, writing the flag to the wrapped element as Obsidian does. (Inherited from AbstractTextComponent) |
| setPlaceholder(placeholder) | this | Sets the element's placeholder text. (Inherited from AbstractTextComponent) |
| setValue(value) | this | Writes the value into the element. As in Obsidian, the change callback is not called, and a value that is not a string is ignored. (Inherited from AbstractTextComponent) |
| static create__(containerEl) | TextAreaComponent | Mock-only factory: creates a text area, spyable via vi.spyOn(TextAreaComponent, 'create__'). |
| static fromOriginalType2__(value) | ValueComponent<string> | Mock-only: views a value typed as Obsidian's ValueComponent as this mock.(Inherited from AbstractTextComponent) |
| static fromOriginalType3__(value) | AbstractTextComponent<HTMLTextAreaElement> | Mock-only: views a value typed as Obsidian's AbstractTextComponent as this mock.(Inherited from AbstractTextComponent) |
| static fromOriginalType4__(value) | TextAreaComponent | Mock-only: views a value typed as Obsidian's TextAreaComponent as this mock. |