继续沉淀结果页返回按钮
新增共享 PlatformBackActionButton 承接结果页轻量返回入口 将拼图方洞拼消消视觉小说等结果页返回按钮收口到共享组件 将拼消消跳一跳敲木鱼宝贝识物结果页返回按钮收口到共享组件 补充对应测试并更新 PlatformUiKit 收口计划与共享决策记录
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/* @vitest-environment jsdom */
|
||||
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { fireEvent, render, screen } from '@testing-library/react';
|
||||
import { beforeEach, expect, test, vi } from 'vitest';
|
||||
|
||||
import type { JumpHopWorkProfileResponse } from '../../../packages/shared/src/contracts/jumpHop';
|
||||
@@ -290,6 +290,32 @@ test('跳一跳草稿结果页不请求公开排行榜', () => {
|
||||
expect(screen.queryByText('排行榜')).toBeNull();
|
||||
});
|
||||
|
||||
test('跳一跳结果页头部返回按钮复用共享 back action button', () => {
|
||||
const onBack = vi.fn();
|
||||
|
||||
render(
|
||||
<JumpHopResultView
|
||||
profile={buildProfile()}
|
||||
onBack={onBack}
|
||||
onEdit={() => {}}
|
||||
onStartTestRun={() => {}}
|
||||
onPublish={() => {}}
|
||||
onRegenerateTiles={() => {}}
|
||||
/>,
|
||||
);
|
||||
|
||||
const backButton = screen.getByRole('button', { name: '返回' });
|
||||
|
||||
expect(backButton.className).toContain('platform-button--ghost');
|
||||
expect(backButton.className).toContain('text-sm');
|
||||
expect(backButton.className).toContain('gap-2');
|
||||
expect(backButton.querySelector('svg')?.className.baseVal).toContain('h-4');
|
||||
|
||||
fireEvent.click(backButton);
|
||||
|
||||
expect(onBack).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
function buildProfile(
|
||||
options: {
|
||||
publicationStatus?: JumpHopWorkProfileResponse['summary']['publicationStatus'];
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
} from '../../services/jump-hop/jumpHopRuntimeModel';
|
||||
import { useJumpHopLeaderboard } from '../../services/jump-hop/useJumpHopLeaderboard';
|
||||
import { PlatformActionButton } from '../common/PlatformActionButton';
|
||||
import { PlatformBackActionButton } from '../common/PlatformBackActionButton';
|
||||
import { PlatformEmptyState } from '../common/PlatformEmptyState';
|
||||
import { PlatformMediaFrame } from '../common/PlatformMediaFrame';
|
||||
import { PlatformMediaTileGrid } from '../common/PlatformMediaTileGrid';
|
||||
@@ -331,15 +332,10 @@ export function JumpHopResultView({
|
||||
return (
|
||||
<div className="platform-remap-surface mx-auto flex h-full min-h-0 w-full max-w-5xl flex-col overflow-y-auto overscroll-contain px-3 pb-[max(1.5rem,env(safe-area-inset-bottom))] pt-3 sm:px-4 sm:pt-4">
|
||||
<div className="mb-3 flex items-center justify-between gap-3">
|
||||
<PlatformActionButton
|
||||
<PlatformBackActionButton
|
||||
onClick={onBack}
|
||||
tone="ghost"
|
||||
size="xs"
|
||||
className="min-h-0 gap-2 py-2 text-sm"
|
||||
>
|
||||
<ArrowLeft className="h-4 w-4" />
|
||||
返回
|
||||
</PlatformActionButton>
|
||||
variant="regular"
|
||||
/>
|
||||
<div className="flex gap-2">
|
||||
<PlatformActionButton
|
||||
onClick={onRegenerateTiles}
|
||||
|
||||
Reference in New Issue
Block a user