BooleanValue
Mock of Obsidian’s BooleanValue, a Bases Value wrapping a boolean.
Import:
import { BooleanValue } from 'obsidian-test-mocks/obsidian';Signature:
export class BooleanValue extends PrimitiveValue<boolean>Extends: PrimitiveValue<boolean>
Constructor
new BooleanValue(value?: boolean)Creates a value wrapping a boolean.
Properties
| Property | Type | Description |
|---|---|---|
| data | boolean | The wrapped primitive. Obsidian's own name for it, which is why this carries no __ suffix (L4).(Inherited from PrimitiveValue) |
| icon | string | The lucide icon name standing for this value's type. |
| type | string | The value type's identifier, 'Boolean' - Obsidian's own name for this class of value. |
Methods
| Method | Returns | Description |
|---|---|---|
| asOriginalType3__() | PrimitiveValueOriginal<boolean> | Mock-only: views this mock as Obsidian's PrimitiveValue type.(Inherited from PrimitiveValue) |
| asOriginalType4__() | BooleanValueOriginal | Mock-only: views this mock as Obsidian's BooleanValue type. Numbered to avoid clashing with the variants its base classes declare. |
| constructor3__(_value) | void | Mock-only construction hook, called at the end of the constructor; a no-op meant for vi.spyOn(PrimitiveValue.prototype, 'constructor3__').(Inherited from PrimitiveValue) |
| constructor4__(_value?) | void | Mock-only construction hook, called at the end of the constructor; a no-op meant for vi.spyOn(BooleanValue.prototype, 'constructor4__'). |
| equals(other) | boolean | Compares this value with another of the same type, as Obsidian does: by strict equality of the wrapped primitives. (Inherited from PrimitiveValue) |
| isTruthy() | boolean | Reports whether the value counts as true in a condition, by JavaScript truthiness of the wrapped primitive. (Inherited from PrimitiveValue) |
| looseEquals(other) | boolean | Loosely compares this value with a value of any type, as Obsidian does: any other primitive value whose wrapped primitive is LOOSELY equal to this one. The == is Obsidian's own and is the whole point of the override - it is what makes BooleanValue(true) loosely equal NumberValue(1) and StringValue('1').(Inherited from PrimitiveValue) |
| renderTo(el, _context) | void | Renders the value into an element, as Obsidian does: a DISABLED checkbox whose checked is the wrapped boolean, rather than the text true or false its base would write.Obsidian sets checked as a PROPERTY after creating the input, not as an attribute, so the rendered element's checked attribute is absent either way and only inputEl.checked answers - which is what a consumer asserting on it has to read. |
| toString() | string | Converts the value to its display string. (Inherited from PrimitiveValue) |
| static create__(value?) | BooleanValue | Mock-only factory: creates a boolean value, spyable via vi.spyOn(BooleanValue, 'create__'). |
| static fromOriginalType3__(value) | PrimitiveValue<boolean> | Mock-only: views a value typed as Obsidian's PrimitiveValue as this mock.(Inherited from PrimitiveValue) |
| static fromOriginalType4__(value) | BooleanValue | Mock-only: views a value typed as Obsidian's BooleanValue as this mock. Numbered to avoid clashing with the variants its base classes declare. |