From 9cf30517db1dbc9abd8f70765db1bf9e44126504 Mon Sep 17 00:00:00 2001 From: Suzumiya Date: Wed, 7 Oct 2026 01:47:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=8F=E8=B0=B1=E7=94=BB=E5=B8=83=EF=BC=9A?= =?UTF-8?q?=E6=81=A2=E5=A4=8D=E8=8A=82=E7=82=B9=E5=8D=A1=E7=89=87=E4=BD=9C?= =?UTF-8?q?=E8=80=85=E5=90=8D=EF=BC=88=E6=8A=BD=20LineageNodeContent=20?= =?UTF-8?q?=E6=97=B6=E5=8F=AA=E7=95=99=E5=9C=A8=20inline=20=E5=B8=83?= =?UTF-8?q?=E5=B1=80=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GameDistributionPages.test.tsx | 21 +++++++++++++++++++ .../game-distribution/GameLineagePage.tsx | 1 + .../game-distribution/LineageNodeContent.tsx | 9 +++++++- 3 files changed, 30 insertions(+), 1 deletion(-) 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}