Skip to content

ValueComponent<T>

Mock of Obsidian’s ValueComponent base class.

Import:

import { ValueComponent } from 'obsidian-test-mocks/obsidian';

Signature:

export class ValueComponent<T> extends BaseComponent

Extends: BaseComponent

Constructor

new ValueComponent()

Creates the component.

Properties

PropertyTypeDescription
disabledbooleanWhether the component is disabled.
(Inherited from BaseComponent)

Methods

MethodReturnsDescription
asOriginalType__()BaseComponentOriginalMock-only: views this mock as Obsidian's BaseComponent type.
(Inherited from BaseComponent)
asOriginalType2__()ValueComponentOriginal<T>Mock-only: views this mock as Obsidian's ValueComponent type.
constructor__()voidMock-only construction hook, called at the end of the constructor; a no-op meant for vi.spyOn(BaseComponent.prototype, 'constructor__').
(Inherited from BaseComponent)
constructor2__()voidMock-only construction hook, called at the end of the constructor; a no-op meant for vi.spyOn(ValueComponent.prototype, 'constructor2__').
getValue()TGets the component's current value.
registerOptionListener(_listeners, _key)thisRegisters 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.
setDisabled(disabled)thisEnables or disables the component. The mock only records the flag in BaseComponent.disabled.
(Inherited from BaseComponent)
setValue(value)thisSets the component's value.
then(callback)thisCalls a function with the component, to configure it inside a builder chain.
(Inherited from BaseComponent)
static fromOriginalType__(value)BaseComponentMock-only: views a value typed as Obsidian's BaseComponent as this mock.
(Inherited from BaseComponent)
static fromOriginalType2__(value)ValueComponent<T>Mock-only: views a value typed as Obsidian's ValueComponent as this mock.

Links to this page: