IconValue
Mock of Obsidian’s IconValue: a string value holding an icon id.
Import:
import { IconValue } from 'obsidian-test-mocks/obsidian';Signature:
export class IconValue extends StringValueExtends: StringValue
Constructor
new IconValue(value?: string)Creates an icon value.
Properties
| Property | Type | Description |
|---|---|---|
| icon | string | The lucide icon name standing for this value's type. |
| type | string | The value type's identifier, 'String' - Obsidian's own name for this class of value.(Inherited from StringValue) |
Methods
| Method | Returns | Description |
|---|---|---|
| asOriginalType4__() | StringValueOriginal | Mock-only: views this mock as Obsidian's StringValue type.(Inherited from StringValue) |
| asOriginalType5__() | IconValueOriginal | Mock-only: views this mock as Obsidian's IconValue type. |
| constructor4__(_value?) | void | Mock-only construction hook, called at the end of the constructor; a no-op meant for vi.spyOn(StringValue.prototype, 'constructor4__').(Inherited from StringValue) |
| constructor5__(_value) | void | Mock-only construction hook, called at the end of the constructor; a no-op meant for vi.spyOn(IconValue.prototype, 'constructor5__'). |
| keys() | string[] | Lists the property keys StringValue.objectAccess answers for. (Inherited from StringValue) |
| objectAccess(key) | null | Value | Reads a named sub-property of this value. (Inherited from StringValue) |
| renderTo(el, _context) | void | Renders the icon into an element, as Obsidian does: the SVG the icon id resolves to, falling back to question-mark-glyph when the id is unknown, and rendering NOTHING when even that does not resolve.In practice the mock takes that last branch: src/internal/icon-registry.ts starts EMPTY on purpose - Obsidian's Lucide set and its own glyphs are deliberately not bundled - so both lookups answer null unless a test has registered the id with addIcon. That is a property of the registry rather than of this method: register question-mark-glyph and every unknown icon renders it, exactly as in the app. |
| static create__(value?) | StringValue | Mock-only factory: creates a string value, spyable via vi.spyOn(StringValue, 'create__').(Inherited from StringValue) |
| static create2__(value?) | IconValue | Mock-only factory: creates an icon value, spyable via vi.spyOn(IconValue, 'create2__'). The subclass variant of StringValue.create__. |
| static fromOriginalType4__(value) | StringValue | Mock-only: views a value typed as Obsidian's StringValue as this mock.(Inherited from StringValue) |
| static fromOriginalType5__(value) | IconValue | Mock-only: views a value typed as Obsidian's IconValue as this mock. |