Reference
jali-layout/testing
An instance for tests, keys, and what a rendered pane would report, without the adapter's internals.
On this page
What your app's own tests need. See Test an instance.
Make an instance
Link to this section: Make an instancecreateTestJali
createJali, kept apart from the page and from other tests: its address in memory (location), storage in memory, a size of 1440 by 900 unless size says otherwise, keys as on a Mac, and no DOM focus moved. search opens it on a link. Its features are the ones you give, with the address always in memory.
createTestJali(options: TestJaliOptions): { jali: Jali; location: TestLocation }testJaliOptions
The same options, for an app that makes its instance in a function of its own: pass options to it, and put your own features before its features ([...defaultFeatures(), ...(options.features ?? [])]), so its memory address takes the place of urlSync().
testJaliOptions(options?: { search?: string; size?: { width: number; height: number } }): { options: Partial<JaliOptions>; location: TestLocation }Report, read and answer
Link to this section: Report, read and answerreportUnsaved
What a rendered pane's useUnsaved reports: what is unsaved in pane, or nothing is (null).
reportUnsaved(jali: AnyJali, pane: string, what: string | null): ActionResultreportPaneState
What a rendered pane's usePaneState keeps: value under key, for the object the pane shows.
reportPaneState(jali: AnyJali, pane: string, key: string, value: unknown): ActionResultpaneStateOf
A pane's own state, for the object it shows now.
paneStateOf(jali: AnyJali, pane: string): Record<string, unknown> | undefineddiscardQuestion
"Discard unsaved changes?", while it is asked: the panes that would lose work.
discardQuestion(jali: AnyJali): { panes: readonly string[] } | nullanswerDiscard
Answers the question as the person would: Discard makes the change it held, Keep editing doesn't.
answerDiscard(jali: AnyJali, answer: "discard" | "keep"): ActionResultchooserRequest
What jali.dialogs.choose is asking the person now, or null. Choose by calling its onChoose.
chooserRequest(jali: AnyJali): ChooseOptions<unknown> | nulllastAnnouncement
The last thing the instance said to assistive technology.
lastAnnouncement(jali: AnyJali): stringTestJaliOptions
createTestJali's options: an instance's, and the link it opens on.
interface TestJaliOptions extends JaliOptions { search?: string }TestLocation
An address in memory: entries lists every address written, and visit changes it as Back or a router link would.
type TestLocation = LocationPort & { entries: string[]; visit(search: string): void }