Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F3010912
mountable-with-fields.test.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
mountable-with-fields.test.ts
View Options
import
type
{
Context
}
from
"koa"
;
import
{
Form
}
from
"../forms/form.js"
;
import
{
FieldTypes
}
from
"sealious"
;
import
{
CollectionField
}
from
"../forms/fields/collection-field.js"
;
import
{
FormData
}
from
"../forms/form-types.js"
;
describe
(
"mountable-with-fields"
,
()
=>
{
it
(
"properly types the getParsedValues method and respects required status"
,
()
=>
{
const
fields
=
{
not_required
:
new
CollectionField
(
false
,
new
FieldTypes
.
Text
()),
required
:
new
CollectionField
(
true
,
new
FieldTypes
.
Text
()),
};
new
(
class
extends
Form
<
typeof
fields
,
void
>
{
fields
=
fields
;
controls
=
[];
async
onSubmit
(
ctx
:
Context
,
form_values
:
FormData
)
{
const
data
=
await
this
.
getParsedValues
(
ctx
);
// this should not throw a Typescript error
data
.
not_required
?
.
trim
();
// this should work without the optional chaining:
data
.
required
.
trim
();
const
{
parsed
:
data2
}
=
await
this
.
fields
.
not_required
.
getValue
(
ctx
,
form_values
.
raw_values
);
data2
?
.
trim
();
}
})();
});
});
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Wed, May 7, 19:49 (22 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
625546
Default Alt Text
mountable-with-fields.test.ts (1 KB)
Attached To
Mode
rSGEN sealgen
Attached
Detach File
Event Timeline
Log In to Comment