Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F3010609
stateful-page.test.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
844 B
Referenced Files
None
Subscribers
None
stateful-page.test.ts
View Options
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
Details
Attached
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)
Attached To
Mode
rSGEN sealgen
Attached
Detach File
Event Timeline
Log In to Comment