继续扩展首页可导航扁平行
扩展 PlatformNavigableListItem 接入桌面今日游戏趋势行 补充首页桌面趋势行的共享行组件回归测试 更新 PlatformUiKit 收口计划与共享决策记录
This commit is contained in:
@@ -5263,8 +5263,9 @@ test('mobile today channel only shows newly published works from today', async (
|
||||
expect(within(discoverPanel).queryByText('今日更新旧作')).toBeNull();
|
||||
});
|
||||
|
||||
test('desktop logged in home syncs mobile home modules without square or latest labels', () => {
|
||||
test('desktop logged in home syncs mobile home modules without square or latest labels', async () => {
|
||||
mockDesktopLayout();
|
||||
const user = userEvent.setup();
|
||||
const todayPublishedAt = new Date().toISOString();
|
||||
const todayEntry = {
|
||||
...puzzlePublicEntry,
|
||||
@@ -5275,6 +5276,7 @@ test('desktop logged in home syncs mobile home modules without square or latest
|
||||
publishedAt: todayPublishedAt,
|
||||
updatedAt: todayPublishedAt,
|
||||
} satisfies PlatformPublicGalleryCard;
|
||||
const onOpenGalleryDetail = vi.fn();
|
||||
|
||||
render(
|
||||
<AuthUiContext.Provider
|
||||
@@ -5326,7 +5328,7 @@ test('desktop logged in home syncs mobile home modules without square or latest
|
||||
onResumeSave={vi.fn()}
|
||||
onOpenCreateWorld={vi.fn()}
|
||||
onOpenCreateTypePicker={vi.fn()}
|
||||
onOpenGalleryDetail={vi.fn()}
|
||||
onOpenGalleryDetail={onOpenGalleryDetail}
|
||||
onOpenLibraryDetail={vi.fn()}
|
||||
onSearchPublicCode={vi.fn()}
|
||||
/>
|
||||
@@ -5336,13 +5338,25 @@ test('desktop logged in home syncs mobile home modules without square or latest
|
||||
expect(screen.getByText('今日游戏')).toBeTruthy();
|
||||
expect(screen.getAllByText('推荐').length).toBeGreaterThan(0);
|
||||
expect(screen.getByText('作品分类')).toBeTruthy();
|
||||
expect(screen.getAllByText('桌面今日新游').length).toBeGreaterThan(0);
|
||||
const todayButton = screen
|
||||
.getAllByText('桌面今日新游')
|
||||
.map((node) => node.closest('.platform-desktop-trending-item'))
|
||||
.find((node): node is HTMLButtonElement => node instanceof HTMLButtonElement);
|
||||
|
||||
if (!todayButton) {
|
||||
throw new Error('缺少桌面今日趋势行');
|
||||
}
|
||||
|
||||
expect(todayButton.className).toContain('platform-navigable-list-item');
|
||||
expect(screen.queryByText('趋势关注')).toBeNull();
|
||||
expect(screen.queryByText('最新发布')).toBeNull();
|
||||
expect(screen.queryByText('作品广场')).toBeNull();
|
||||
expect(screen.queryByText('公开作品')).toBeNull();
|
||||
expect(screen.queryByText('PZ-EPUBLIC1')).toBeNull();
|
||||
expect(screen.queryByText('1777110165.990127Z')).toBeNull();
|
||||
|
||||
await user.click(todayButton);
|
||||
expect(onOpenGalleryDetail).toHaveBeenCalledWith(todayEntry);
|
||||
});
|
||||
|
||||
test('desktop home quick access rows reuse shared navigable list item', async () => {
|
||||
|
||||
@@ -1916,24 +1916,28 @@ function DesktopTrendingItem({
|
||||
const tags = buildPlatformWorldDisplayTags(entry, 2);
|
||||
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
<PlatformNavigableListItem
|
||||
onClick={onClick}
|
||||
className="platform-desktop-trending-item flex items-start gap-4 px-4 py-4 text-left"
|
||||
align="start"
|
||||
className="platform-desktop-trending-item px-4 py-4"
|
||||
leading={
|
||||
<div className="relative h-[5.5rem] w-[4.3rem] shrink-0 overflow-hidden rounded-[1rem] border border-[var(--platform-subpanel-border)] bg-[rgba(255,255,255,0.66)]">
|
||||
{coverImage ? (
|
||||
<PlatformWorkCoverArtwork
|
||||
entry={entry}
|
||||
imageSrc={coverImage}
|
||||
alt={entry.worldName}
|
||||
className="h-full w-full object-cover"
|
||||
/>
|
||||
) : null}
|
||||
<div className="absolute inset-0 bg-[linear-gradient(180deg,rgba(255,255,255,0.04),rgba(91,24,46,0.26))]" />
|
||||
</div>
|
||||
}
|
||||
trailing={
|
||||
<ChevronRight className="h-4 w-4 shrink-0 text-[var(--platform-text-soft)]" />
|
||||
}
|
||||
>
|
||||
<div className="relative h-[5.5rem] w-[4.3rem] shrink-0 overflow-hidden rounded-[1rem] border border-[var(--platform-subpanel-border)] bg-[rgba(255,255,255,0.66)]">
|
||||
{coverImage ? (
|
||||
<PlatformWorkCoverArtwork
|
||||
entry={entry}
|
||||
imageSrc={coverImage}
|
||||
alt={entry.worldName}
|
||||
className="h-full w-full object-cover"
|
||||
/>
|
||||
) : null}
|
||||
<div className="absolute inset-0 bg-[linear-gradient(180deg,rgba(255,255,255,0.04),rgba(91,24,46,0.26))]" />
|
||||
</div>
|
||||
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="min-w-0">
|
||||
<div className="flex items-center gap-2 text-[10px] tracking-[0.18em] text-[var(--platform-text-soft)]">
|
||||
<span>{`${rank}`.padStart(2, '0')}</span>
|
||||
<span className="truncate">
|
||||
@@ -1975,9 +1979,7 @@ function DesktopTrendingItem({
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ChevronRight className="h-4 w-4 shrink-0 text-[var(--platform-text-soft)]" />
|
||||
</button>
|
||||
</PlatformNavigableListItem>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user