diff --git a/src/components/game-distribution/GameDistributionPages.test.tsx b/src/components/game-distribution/GameDistributionPages.test.tsx index 0fb937476..f82904b8d 100644 --- a/src/components/game-distribution/GameDistributionPages.test.tsx +++ b/src/components/game-distribution/GameDistributionPages.test.tsx @@ -2431,6 +2431,27 @@ describe('GameLineagePage 可视化与交互', () => { truncated: false, }; + it('画布节点卡片显示作者名(与血缘链/大纲同信息密度)', async () => { + getGameLineageMock.mockResolvedValueOnce(buildChainDataset()); + render( + , + ); + + 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(); diff --git a/src/components/game-distribution/GameLineagePage.tsx b/src/components/game-distribution/GameLineagePage.tsx index c37f95a0d..d32035fe2 100644 --- a/src/components/game-distribution/GameLineagePage.tsx +++ b/src/components/game-distribution/GameLineagePage.tsx @@ -179,6 +179,7 @@ function LineageTreeNodeCard({ isAnchor={isAnchor} isStub={isStub} isTrunk={layoutNode.isTrunk} + compact={compact} /> diff --git a/src/components/game-distribution/LineageNodeContent.tsx b/src/components/game-distribution/LineageNodeContent.tsx index 395ad5c77..4d4a73fed 100644 --- a/src/components/game-distribution/LineageNodeContent.tsx +++ b/src/components/game-distribution/LineageNodeContent.tsx @@ -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({ {displayTitle} - {layout === 'stacked' ? null : ( + {/* + 作者名在两种形态都渲染(画布卡片曾因重构一度漏掉,导致节点少了作者信息、 + 也踩到了 e2e 的作者名断言):只有窄屏图谱的紧凑卡片才省掉它。 + */} + {layout === 'stacked' && compact ? null : ( {authorLabel}