release: WRNexusJS 0.6.0
This commit is contained in:
@@ -128,3 +128,24 @@ test("extracts declared events and validates component event bindings", () => {
|
||||
["wrn-unknown-component-event"],
|
||||
);
|
||||
});
|
||||
|
||||
test("extracts v0.6 optional props, declared union options, and outputs", () => {
|
||||
const metadata = parseComponentMetadata(`component Dialog {
|
||||
outputs { confirm(payload: string) cancel() }
|
||||
props {
|
||||
title: string
|
||||
description?: string
|
||||
size: "small" | "large" = "small"
|
||||
}
|
||||
view { <div></div> }
|
||||
}`);
|
||||
assert.deepEqual(metadata.events, ["confirm", "cancel"]);
|
||||
assert.deepEqual(
|
||||
metadata.props.map(({ name, required, options }) => ({ name, required, options })),
|
||||
[
|
||||
{ name: "title", required: true, options: [] },
|
||||
{ name: "description", required: false, options: [] },
|
||||
{ name: "size", required: false, options: ["small", "large"] },
|
||||
],
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user