This commit is contained in:
2026-05-08 22:07:08 +08:00
parent 65c2b8cd79
commit 96df12cd15
4 changed files with 43 additions and 3 deletions

View File

@@ -446,6 +446,34 @@ test('右上角设置按钮打开拼图设置并支持音量调节', () => {
expect(authValue.setMusicVolume).toHaveBeenCalledWith(0.77);
});
test('推荐页嵌入拼图时隐藏返回和设置里的退出入口', () => {
renderPuzzleRuntime(
<PuzzleRuntimeShell
run={clearedRun}
embedded
hideExitControls
onBack={vi.fn()}
onRemodelWork={vi.fn()}
onSwapPieces={vi.fn()}
onDragPiece={vi.fn()}
onAdvanceNextLevel={vi.fn()}
/>,
);
const backButton = screen.getByRole('button', { name: '返回上一页' });
expect((backButton as HTMLButtonElement).disabled).toBe(true);
expect(backButton.className).toContain('invisible');
fireEvent.click(screen.getByRole('button', { name: '打开拼图设置' }));
const dialog = screen.getByRole('dialog', { name: '拼图设置' });
expect(within(dialog).getByRole('button', { name: '继续拼图' })).toBeTruthy();
expect(
within(dialog).queryByRole('button', { name: '返回上一页' }),
).toBeNull();
expect(within(dialog).queryByText('保存并退出')).toBeNull();
});
test('拼图棋盘使用贴近移动端边缘的正方形舞台承载切块', () => {
const { container } = renderPuzzleRuntime(
<PuzzleRuntimeShell