Page MenuHomeSealhub

stateful-page.test.ts
No OneTemporary

stateful-page.test.ts

import { BaseContext } from "koa";
import { Templatable, tempstream } from "tempstream";
import { StatefulPage } from "./stateful-page.js";
describe("stateful page", () => {
it("handles a basic case with action buttons", () => {
type TestState = {};
const actions = <const>{
some_action: async (
_ctx: BaseContext,
_state: TestState,
_inputs: Record<string, unknown>,
_arg1: number
) => {},
};
new (class extends StatefulPage<TestState, typeof actions> {
actions = actions;
getInitialState(_ctx: BaseContext) {
return {};
}
wrapInLayout(_ctx: BaseContext, content: Templatable, _state: TestState): Templatable {
return content;
}
render(_ctx: BaseContext, state: TestState) {
return tempstream`<div>${this.makeActionButton(state, "some_action", 2)}</div>`;
}
})();
});
});

File Metadata

Mime Type
text/x-java
Expires
Wed, May 7, 19:45 (1 d, 6 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
624776
Default Alt Text
stateful-page.test.ts (844 B)

Event Timeline