Project typed records as semantic list items
This commit is contained in:
parent
00141b6473
commit
fe81204177
3 changed files with 8 additions and 8 deletions
6
packages/eve-browser-lowering/dist/index.js
vendored
6
packages/eve-browser-lowering/dist/index.js
vendored
|
|
@ -627,9 +627,9 @@ export function renderEveComponent(node, options = currentOptions) {
|
|||
export function projectSemanticListItem(node) {
|
||||
const props = objectProps(node.props);
|
||||
return {
|
||||
label: firstString(props.label, props.title, node.text, node.kind, "item"),
|
||||
status: firstString(props.status, ""),
|
||||
detail: firstString(props.detail, props.phase, ""),
|
||||
label: firstString(props.label, props.title, props.displayName, node.text, node.kind, "item"),
|
||||
status: firstString(props.status, props.state, ""),
|
||||
detail: firstString(props.detail, props.phase, props.repoName, ""),
|
||||
badges: Array.isArray(props.badges)
|
||||
? props.badges.map(value => String(value).trim()).filter(Boolean)
|
||||
: firstString(props.badges, "").split(",").map(value => value.trim()).filter(Boolean),
|
||||
|
|
|
|||
|
|
@ -808,9 +808,9 @@ export function renderEveComponent(
|
|||
export function projectSemanticListItem(node: EveSurfaceComponent): EveSemanticListItem {
|
||||
const props = objectProps(node.props);
|
||||
return {
|
||||
label: firstString(props.label, props.title, node.text, node.kind, "item"),
|
||||
status: firstString(props.status, ""),
|
||||
detail: firstString(props.detail, props.phase, ""),
|
||||
label: firstString(props.label, props.title, props.displayName, node.text, node.kind, "item"),
|
||||
status: firstString(props.status, props.state, ""),
|
||||
detail: firstString(props.detail, props.phase, props.repoName, ""),
|
||||
badges: Array.isArray(props.badges)
|
||||
? props.badges.map(value => String(value).trim()).filter(Boolean)
|
||||
: firstString(props.badges, "").split(",").map(value => value.trim()).filter(Boolean),
|
||||
|
|
|
|||
|
|
@ -96,10 +96,10 @@ test("projects unknown semantic items through the generic list contract", () =>
|
|||
test("projects provider-owned list data through the same semantic item contract", () => {
|
||||
assert.deepEqual(projectSemanticListItems([
|
||||
{ label: "Face One", status: "working", detail: "Current turn", badges: ["repo", "live"] },
|
||||
{ label: "Face Two", status: "ready" },
|
||||
{ displayName: "Face Two", state: "ready", repoName: "VoidBot" },
|
||||
]), [
|
||||
{ label: "Face One", status: "working", detail: "Current turn", badges: ["repo", "live"] },
|
||||
{ label: "Face Two", status: "ready", detail: "", badges: [] },
|
||||
{ label: "Face Two", status: "ready", detail: "VoidBot", badges: [] },
|
||||
]);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue