族谱画布:恢复节点卡片作者名(抽 LineageNodeContent 时只留在 inline 布局)
Project CI / Native shell tests (pull_request) Has been cancelled
Project CI / Frontend tests (pull_request) Has been cancelled
Project CI / Repository checks (pull_request) Has been cancelled
Project CI / AI game creator shell web tests (pull_request) Has been cancelled
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust crates (pull_request) Has been cancelled
Project CI / Backend tests (pull_request) Has been cancelled

This commit is contained in:
2026-10-07 01:47:12 +08:00
parent 32f4025516
commit 9cf30517db
3 changed files with 30 additions and 1 deletions
@@ -2431,6 +2431,27 @@ describe('GameLineagePage 可视化与交互', () => {
truncated: false,
};
it('画布节点卡片显示作者名(与血缘链/大纲同信息密度)', async () => {
getGameLineageMock.mockResolvedValueOnce(buildChainDataset());
render(
<GameLineagePage
rootGameId="game-root"
highlightGameId="game-current"
onBack={vi.fn()}
onOpenDetail={vi.fn()}
/>,
);
await screen.findByRole('button', { name: '打开《根原创》详情' });
// 画布(stacked)卡片必须有作者行:抽出 LineageNodeContent 时作者行一度只留在 inline
// 布局,族谱树页面因此丢了作者名(并被 check-game-distribution-lineage-e2e 抓到)。
expect(
Array.from(document.querySelectorAll('.game-lineage-node__author'))
.map((element) => element.textContent)
.sort(),
).toEqual(['一代作者', '当前作者', '根作者']);
});
it('节点是真实 DOM 卡片:主体点击=选中、标题/打开作品=进详情、当前作品有标记且父在上子在下', async () => {
getGameLineageMock.mockResolvedValueOnce(treeWithSibling);
const onOpenDetail = vi.fn();
@@ -179,6 +179,7 @@ function LineageTreeNodeCard({
isAnchor={isAnchor}
isStub={isStub}
isTrunk={layoutNode.isTrunk}
compact={compact}
/>
</button>
<span className="game-lineage-node__actions">
@@ -20,6 +20,7 @@ export function LineageNodeContent({
isAnchor = false,
isStub = false,
isTrunk = false,
compact = false,
}: {
title: string | null;
authorName: string | null;
@@ -29,6 +30,8 @@ export function LineageNodeContent({
isAnchor?: boolean;
isStub?: boolean;
isTrunk?: boolean;
/** 画布卡片的紧凑态(窄屏图谱):省掉作者行;大纲/血缘链行始终保留作者名。 */
compact?: boolean;
}) {
const displayTitle = isStub ? '原作品已不可用' : (title ?? '未命名作品');
const authorLabel = isStub
@@ -62,7 +65,11 @@ export function LineageNodeContent({
</span>
<span className="game-lineage-node__text">
<span className="game-lineage-node__title">{displayTitle}</span>
{layout === 'stacked' ? null : (
{/*
作者名在两种形态都渲染(画布卡片曾因重构一度漏掉,导致节点少了作者信息、
也踩到了 e2e 的作者名断言):只有窄屏图谱的紧凑卡片才省掉它。
*/}
{layout === 'stacked' && compact ? null : (
<span className="game-lineage-node__meta">
<span className="game-lineage-node__author">{authorLabel}</span>
</span>