族谱:删除「高亮整棵子树」复选框,子树高亮恒定开启(不再有恒为 true 的开关状态)
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
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
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
This commit is contained in:
@@ -2631,6 +2631,44 @@ describe('GameLineagePage 可视化与交互', () => {
|
||||
).toBe('false');
|
||||
});
|
||||
|
||||
it('子树高亮恒生效、开关已删除(不保留恒为 true 的控件)', async () => {
|
||||
getGameLineageMock.mockResolvedValueOnce(relationTree);
|
||||
render(
|
||||
<GameLineagePage
|
||||
rootGameId="game-root"
|
||||
highlightGameId="game-current"
|
||||
onBack={vi.fn()}
|
||||
onOpenDetail={vi.fn()}
|
||||
/>,
|
||||
);
|
||||
|
||||
await cardOf('当前作品');
|
||||
// ⑥ 复选框不存在(不是禁用、不是隐藏文案)。
|
||||
expect(screen.queryByText('高亮整棵子树')).toBeNull();
|
||||
expect(screen.queryByLabelText('高亮整棵子树')).toBeNull();
|
||||
// 其他筛选控件还在,说明删的是这一个而不是整行。
|
||||
expect(screen.getByLabelText('按热度排序')).toBeTruthy();
|
||||
|
||||
// 行为恒生效:hover 一个中间节点 → 它的**后代**(孙代)不降透明,旁支才降透明。
|
||||
// 没有开关可关掉它,因为这段行为不再依赖任何状态。
|
||||
const midCard = await cardOf('中间代');
|
||||
fireEvent.mouseEnter(midCard);
|
||||
expect((await cardOf('孙代作品')).className).not.toContain(
|
||||
'game-lineage-node--dimmed',
|
||||
);
|
||||
expect((await cardOf('旁支叔伯')).className).toContain(
|
||||
'game-lineage-node--dimmed',
|
||||
);
|
||||
// 子树里的节点带上「子树」强化类,与祖先路径(path)区分开。
|
||||
expect((await cardOf('孙代作品')).className).toContain(
|
||||
'game-lineage-node--subtree',
|
||||
);
|
||||
fireEvent.mouseLeave(midCard);
|
||||
expect((await cardOf('旁支叔伯')).className).not.toContain(
|
||||
'game-lineage-node--dimmed',
|
||||
);
|
||||
});
|
||||
|
||||
it('节点是真实 DOM 卡片:主体点击=选中、标题/打开作品=进详情、当前作品有标记且父在上子在下', async () => {
|
||||
getGameLineageMock.mockResolvedValueOnce(treeWithSibling);
|
||||
const onOpenDetail = vi.fn();
|
||||
|
||||
@@ -247,7 +247,6 @@ export function GameLineagePage({
|
||||
null,
|
||||
);
|
||||
const isMobileViewport = useIsMobileViewport();
|
||||
const [includeSubtree, setIncludeSubtree] = useState(true);
|
||||
/**
|
||||
* 形态:移动端默认**大纲式缩进树**(无横向滚动、触控友好),可用「图谱视图」切回画布;
|
||||
* 桌面默认画布。`null` = 跟随当前断点的默认值。
|
||||
@@ -392,11 +391,11 @@ export function GameLineagePage({
|
||||
const highlighted = useMemo(
|
||||
() =>
|
||||
highlightTargetId
|
||||
? collectLineageHighlight(layout.nodes, highlightTargetId, {
|
||||
includeSubtree,
|
||||
})
|
||||
? // 子树高亮**恒定开启**(2026-10-06 口径:原来那个「高亮整棵子树」复选框没有意义,
|
||||
// 已删除,也不再保留一个恒为 true 的开关状态到处传)。
|
||||
collectLineageHighlight(layout.nodes, highlightTargetId)
|
||||
: null,
|
||||
[highlightTargetId, includeSubtree, layout.nodes],
|
||||
[highlightTargetId, layout.nodes],
|
||||
);
|
||||
const pathIds = useMemo(
|
||||
() =>
|
||||
@@ -860,16 +859,10 @@ export function GameLineagePage({
|
||||
</label>
|
||||
</div>
|
||||
<div className="game-lineage-viewport-controls">
|
||||
<label className="game-lineage-toggle">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={includeSubtree}
|
||||
onChange={(event) =>
|
||||
setIncludeSubtree(event.target.checked)
|
||||
}
|
||||
/>
|
||||
高亮整棵子树
|
||||
</label>
|
||||
{/*
|
||||
这里原来有个「高亮整棵子树」复选框:它恒为真、没有任何用户可见意义(2026-10-06
|
||||
口径——删除并**默认开启**)。子树高亮现在是唯一行为,不再有开关状态。
|
||||
*/}
|
||||
{fitHint && embedded ? (
|
||||
<span className="game-lineage-fork-notice" role="status">
|
||||
{fitHint}
|
||||
|
||||
Reference in New Issue
Block a user