decision-center: add stable testIds to empty states and fix ambiguous doc list item testid

This commit is contained in:
Codex
2026-05-21 13:54:19 +00:00
parent 133d417d01
commit a980d09b19
@@ -674,7 +674,7 @@ function DocWorkspace({ records, selectedRecord, onSelect, onSave, saving, saveE
type: "button",
className: `doc-list-item ${selectedRecord?.id === record.id ? "selected" : ""}`,
onClick: () => onSelect(record),
"data-testid": `doc-list-item-${stableTestId(record.id)}`,
"data-testid": `doc-record-item-${stableTestId(record.id)}`,
},
h("span", { className: "doc-list-meta" },
h("span", null, metadata.docType || record.type || "--"),
@@ -887,7 +887,7 @@ function RecordCard({ record, onRaw, compact, onEdit }: AnyRecord) {
}
function RecordTable({ records, onRaw, onEdit }: AnyRecord) {
if (!records.length) return h(EmptyState, { title: "暂无记录", text: "通过 CLI 上传会议记录或决议后会显示在这里。" });
if (!records.length) return h(EmptyState, { title: "暂无记录", text: "通过 CLI 上传会议记录或决议后会显示在这里。", "data-testid": "decision-record-table-empty" });
return h("div", { className: "table-wrap" },
h("table", { className: "decision-table", "data-testid": "decision-center-record-table" },
h("thead", null, h("tr", null,
@@ -975,7 +975,7 @@ function GoalBreakdown({ records, onEdit, onRaw }: AnyRecord) {
childrenByParent.set(parentId, bucket);
}
const externalGoals = goals.filter(isExternalGoal);
if (externalGoals.length === 0) return h(EmptyState, { title: "暂无拆解关系", text: "创建 G0 外部目标后,可用 Linked Goal 或 parent 标签把内部目标关联上去。" });
if (externalGoals.length === 0) return h(EmptyState, { title: "暂无拆解关系", text: "创建 G0 外部目标后,可用 Linked Goal 或 parent 标签把内部目标关联上去。", "data-testid": "goal-breakdown-empty" });
return h("div", { className: "goal-breakdown", "data-testid": "goal-breakdown" },
externalGoals.slice(0, 12).map((goal: any) => {
const explicitChildIds = goalChildIds(goal);
@@ -1503,7 +1503,7 @@ export function DecisionCenterPage({ microservices, onRaw, apiBaseUrl = "/api" }
h("div", { className: "diary-layout" },
h(Panel, { title: "按天条目", eyebrow: `${diaryEntries.length} Entries`, loading: diaryState.loading },
diaryEntries.length === 0
? h(EmptyState, { title: "暂无日记", text: "点击“今天”后可自动创建当天 Markdown 日记。" })
? h(EmptyState, { title: "暂无日记", text: "点击“今天”后可自动创建当天 Markdown 日记。", "data-testid": "diary-entry-list-empty" })
: h("div", { className: "diary-entry-list" }, diaryEntries.map((entry: any) => h(DiaryEntryCard, { key: entry.id, entry, selected: selectedDiary?.id === entry.id, onSelect: selectDiaryEntry, onRaw }))),
),
h(Panel, { title: selectedDiary?.title || "日记正文", eyebrow: selectedDiary?.markdownPath || "Daily Markdown", actions: selectedDiary ? h(RawButton, { title: `Diary ${selectedDiary.date}`, data: selectedDiary, onOpen: onRaw, testId: "raw-decision-center-diary-selected" }) : null },