Skip to content

createDialogTestHarness

Creates a DialogContext with no App, answered by a fresh ScriptedDialogDriver.

A step that passes through throws there, since there is no real modal to open.

Import:

import { createDialogTestHarness } from '@mnaoumov/obsidian-lib/modals/scripted-dialog-driver';

Signature:

function createDialogTestHarness(steps: readonly (((ScriptedDialogPassthroughStep | ScriptedDialogAlertStep | ScriptedDialogValueProviderStep<"alert">) & ScriptedDialogStepBase<"alert">) | ((ScriptedDialogPassthroughStep | ScriptedDialogValueStep<"confirm"> | ScriptedDialogValueProviderStep<"confirm">) & ScriptedDialogStepBase<"confirm">) | ((ScriptedDialogPassthroughStep | ScriptedDialogValueStep<"prompt"> | ScriptedDialogValueProviderStep<"prompt">) & ScriptedDialogStepBase<"prompt">) | ((ScriptedDialogPassthroughStep | ScriptedDialogValueStep<"selectItem"> | ScriptedDialogValueProviderStep<"selectItem">) & ScriptedDialogStepBase<"selectItem">) | ((ScriptedDialogPassthroughStep | ScriptedDialogValueStep<"selectOption"> | ScriptedDialogValueProviderStep<"selectOption">) & ScriptedDialogStepBase<"selectOption">))[], options: ScriptedDialogDriverConstructorOptions): DialogTestHarness

Parameters:

Parameter Type Description
steps readonly (((ScriptedDialogPassthroughStep | ScriptedDialogAlertStep | ScriptedDialogValueProviderStep<“alert”>) & ScriptedDialogStepBase<“alert”>) | ((ScriptedDialogPassthroughStep | ScriptedDialogValueStep<“confirm”> | ScriptedDialogValueProviderStep<“confirm”>) & ScriptedDialogStepBase<“confirm”>) | ((ScriptedDialogPassthroughStep | ScriptedDialogValueStep<“prompt”> | ScriptedDialogValueProviderStep<“prompt”>) & ScriptedDialogStepBase<“prompt”>) | ((ScriptedDialogPassthroughStep | ScriptedDialogValueStep<“selectItem”> | ScriptedDialogValueProviderStep<“selectItem”>) & ScriptedDialogStepBase<“selectItem”>) | ((ScriptedDialogPassthroughStep | ScriptedDialogValueStep<“selectOption”> | ScriptedDialogValueProviderStep<“selectOption”>) & ScriptedDialogStepBase<“selectOption”>))[] The expected dialogs, in order.
options ScriptedDialogDriverConstructorOptions The driver options.

Returns: DialogTestHarness — The harness.


Links to this page: