Skip to content

@mndw/sdk / @mndw/sdk/testing

@mndw/sdk/testing ​

Interfaces ​

TestI18n ​

Defined in: frontend/sdk/src/testing/i18n.ts:8

Extends ​

Properties ​

change$ ​

readonly change$: Observable<void>

Defined in: frontend/sdk/src/i18n.ts:14

Inherited from ​

PluginI18n.change$

direction ​

readonly direction: "ltr"

Defined in: frontend/sdk/src/i18n.ts:10

Inherited from ​

PluginI18n.direction

locale ​

readonly locale: string

Defined in: frontend/sdk/src/i18n.ts:9

Inherited from ​

PluginI18n.locale

Methods ​

formatDate() ​

formatDate(value, options?): string

Defined in: frontend/sdk/src/i18n.ts:13

Parameters ​
value ​

Date

options? ​

DateTimeFormatOptions

Returns ​

string

Inherited from ​

PluginI18n.formatDate

formatNumber() ​

formatNumber(value, options?): string

Defined in: frontend/sdk/src/i18n.ts:12

Parameters ​
value ​

number

options? ​

NumberFormatOptions

Returns ​

string

Inherited from ​

PluginI18n.formatNumber

setLocale() ​

setLocale(next, catalog): void

Defined in: frontend/sdk/src/testing/i18n.ts:9

Parameters ​
next ​

string

catalog ​

TestCatalog

Returns ​

void

t() ​

t(key, values?): string

Defined in: frontend/sdk/src/i18n.ts:11

Parameters ​
key ​

string

values? ​

Record<string, unknown>

Returns ​

string

Inherited from ​

PluginI18n.t


TestPluginContext ​

Defined in: frontend/sdk/src/testing/plugin-context.ts:37

Type Parameters ​

C ​

C extends PluginContext = PluginContext

Properties ​

context ​

readonly context: C

Defined in: frontend/sdk/src/testing/plugin-context.ts:38

readonly navigationCalls: HostTarget[]

Defined in: frontend/sdk/src/testing/plugin-context.ts:39

Methods ​

emitEvent() ​

emitEvent(event): void

Defined in: frontend/sdk/src/testing/plugin-context.ts:44

Parameters ​
event ​

{ id: string; payload: Record<string, unknown>; source: unknown; topic: "wan.connected"; ts: number; } | { id: string; payload: Record<string, unknown>; source: unknown; topic: "wan.disconnected"; ts: number; } | { id: string; payload: { address: string; connected: boolean; link: string; mask: string; }; source: unknown; topic: "net.ip_changed"; ts: number; } | { id: string; payload: Record<string, unknown>; source: unknown; topic: "net.dhcp_lease"; ts: number; } | { id: string; payload: { resolvers: string[]; }; source: unknown; topic: "net.dns_changed"; ts: number; } | { id: string; payload: Record<string, unknown>; source: unknown; topic: "wifi.client_join"; ts: number; } | { id: string; payload: Record<string, unknown>; source: unknown; topic: "wifi.client_leave"; ts: number; } | { id: string; payload: Record<string, unknown>; source: unknown; topic: "firewall.rebuilt"; ts: number; } | { id: string; payload: Record<string, unknown>; source: unknown; topic: "usb.attached"; ts: number; } | { id: string; payload: Record<string, unknown>; source: unknown; topic: "usb.detached"; ts: number; } | { id: string; payload: Record<string, unknown>; source: unknown; topic: "fs.mounted"; ts: number; } | { id: string; payload: Record<string, unknown>; source: unknown; topic: "fs.unmounted"; ts: number; } | { id: string; payload: { offset_ms?: number; }; source: unknown; topic: "clock.synced"; ts: number; } | { id: string; payload: { action: string; elapsed: number; name: string; }; source: unknown; topic: "schedule.fired"; ts: number; } | { id: string; payload: Record<string, unknown>; source: unknown; topic: "button.pressed"; ts: number; } | { id: string; payload: { ip: string; success: boolean; user: string; }; source: unknown; topic: "auth.login"; ts: number; } | { id: string; payload: Record<string, unknown>; source: unknown; topic: "firmware.available"; ts: number; } | { id: string; payload: Record<string, unknown>; source: unknown; topic: "plugin.installed"; ts: number; } | { id: string; payload: Record<string, unknown>; source: unknown; topic: "plugin.removed"; ts: number; } | { id: string; payload: Record<string, unknown>; source: unknown; topic: "plugin.approved"; ts: number; } | { id: string; payload: Record<string, unknown>; source: unknown; topic: "plugin.started"; ts: number; } | { id: string; payload: { name: string; reason: string; }; source: unknown; topic: "plugin.stopped"; ts: number; } | { id: string; payload: { uptime_ms: number; version: string; }; source: unknown; topic: "daemon.started"; ts: number; } | { id: string; payload: Record<string, unknown>; source: unknown; topic: "daemon.stopping"; ts: number; } | { id: string; payload: Record<string, unknown>; source: unknown; topic: "daemon.updated"; ts: number; } | { id: string; payload: { available_bytes: number; path: "/opt"; threshold_bytes: number; }; source: unknown; topic: "storage.low"; ts: number; } | { id: string; payload: { enabled: boolean; }; source: unknown; topic: "telemetry.gathering_changed"; ts: number; }

Returns ​

void

resync() ​

resync(): void

Defined in: frontend/sdk/src/testing/plugin-context.ts:45

Returns ​

void

setLocale() ​

setLocale(locale): void

Defined in: frontend/sdk/src/testing/plugin-context.ts:41

Parameters ​
locale ​

string

Returns ​

void

setPalette() ​

setPalette(palette): void

Defined in: frontend/sdk/src/testing/plugin-context.ts:42

Parameters ​
palette ​

PaletteTokenMap

Returns ​

void

setTheme() ​

setTheme(theme): void

Defined in: frontend/sdk/src/testing/plugin-context.ts:40

Parameters ​
theme ​

"light" | "dark"

Returns ​

void

tick() ​

tick(timestamp?): void

Defined in: frontend/sdk/src/testing/plugin-context.ts:43

Parameters ​
timestamp? ​

number

Returns ​

void

unmount() ​

unmount(): void

Defined in: frontend/sdk/src/testing/plugin-context.ts:46

Returns ​

void


TestPluginContextOptions ​

Defined in: frontend/sdk/src/testing/plugin-context.ts:23

Properties ​

backend? ​

optional backend?: BackendClient

Defined in: frontend/sdk/src/testing/plugin-context.ts:30

events? ​

optional events?: boolean

Defined in: frontend/sdk/src/testing/plugin-context.ts:34

i18n? ​

optional i18n?: PluginI18n

Defined in: frontend/sdk/src/testing/plugin-context.ts:28

instanceId? ​

optional instanceId?: string

Defined in: frontend/sdk/src/testing/plugin-context.ts:33

kind? ​

optional kind?: "widget" | "page"

Defined in: frontend/sdk/src/testing/plugin-context.ts:24

locale? ​

optional locale?: string

Defined in: frontend/sdk/src/testing/plugin-context.ts:26

pageRoute? ​

optional pageRoute?: PageRoute

Defined in: frontend/sdk/src/testing/plugin-context.ts:32

palette? ​

optional palette?: PaletteTokenMap

Defined in: frontend/sdk/src/testing/plugin-context.ts:27

rciManager? ​

optional rciManager?: Partial<PluginRciManager>

Defined in: frontend/sdk/src/testing/plugin-context.ts:29

telemetry? ​

optional telemetry?: Partial<PluginTelemetry>

Defined in: frontend/sdk/src/testing/plugin-context.ts:31

theme? ​

optional theme?: "light" | "dark"

Defined in: frontend/sdk/src/testing/plugin-context.ts:25

Type Aliases ​

TestCatalog ​

TestCatalog = Record<string, string> | Record<string, unknown>

Defined in: frontend/sdk/src/testing/i18n.ts:6

Functions ​

clearBody() ​

clearBody(): void

Defined in: frontend/sdk/src/testing/dom.ts:33

Returns ​

void


createTestI18n() ​

createTestI18n(catalog?, locale?): TestI18n

Defined in: frontend/sdk/src/testing/i18n.ts:12

Parameters ​

catalog? ​

TestCatalog = {}

locale? ​

string = 'en'

Returns ​

TestI18n


createTestPluginContext() ​

Call Signature ​

createTestPluginContext(options?): TestPluginContext<WidgetPluginContext>

Defined in: frontend/sdk/src/testing/plugin-context.ts:136

Parameters ​
options? ​

TestPluginContextOptions & object

Returns ​

TestPluginContext<WidgetPluginContext>

Call Signature ​

createTestPluginContext(options): TestPluginContext<PagePluginContext>

Defined in: frontend/sdk/src/testing/plugin-context.ts:139

Parameters ​
options ​

TestPluginContextOptions & object

Returns ​

TestPluginContext<PagePluginContext>


installDomObserverStubs() ​

installDomObserverStubs(): void

Defined in: frontend/sdk/src/testing/observers.ts:29

Returns ​

void


nonNull() ​

nonNull<T>(value, what): T

Defined in: frontend/sdk/src/testing/dom.ts:25

Type Parameters ​

T ​

T

Parameters ​

value ​

T | null | undefined

what ​

string

Returns ​

T


shadowOf() ​

shadowOf(el): ShadowRoot

Defined in: frontend/sdk/src/testing/dom.ts:1

Parameters ​

el ​

HTMLElement

Returns ​

ShadowRoot


shadowQuery() ​

shadowQuery<T>(el, selector): T

Defined in: frontend/sdk/src/testing/dom.ts:11

Type Parameters ​

T ​

T extends Element

Parameters ​

el ​

HTMLElement

selector ​

string

Returns ​

T


shadowQueryAll() ​

shadowQueryAll<T>(el, selector): T[]

Defined in: frontend/sdk/src/testing/dom.ts:21

Type Parameters ​

T ​

T extends Element

Parameters ​

el ​

HTMLElement

selector ​

string

Returns ​

T[]

Built from the mndw repository documentation.