恢复移动端原有提示与门禁

恢复移动端首次进入欢迎遮罩与单次关闭状态
恢复删除前的桌面端创作主页提示与旧 IP 资源
保留移动端仅“我的”页签及项目画布硬门禁
补充现役依赖、静态资源与回归测试门禁
同步平台入口权威文档
This commit is contained in:
2026-08-08 15:46:22 +08:00
parent b63923eb04
commit 1fb72ba26c
10 changed files with 344 additions and 38 deletions
@@ -218,6 +218,15 @@ describe('PlatformEntryActiveFlowShell', () => {
.getAllByRole('button')
.map((button) => button.getAttribute('aria-label')),
).toEqual(['我的']);
expect(await screen.findByRole('main', { name: '我的' })).toBeTruthy();
expect(
within(navigation)
.getByRole('button', { name: '我的' })
.getAttribute('aria-current'),
).toBe('page');
expect(
screen.queryByRole('main', { name: '陶泥儿创作主页' }),
).toBeNull();
fireEvent.click(within(navigation).getByRole('button', { name: '我的' }));
expect(window.location.pathname).toBe('/profile');
@@ -226,6 +235,48 @@ describe('PlatformEntryActiveFlowShell', () => {
});
});
it('restores the original blocking welcome on mobile until acknowledged', async () => {
responsiveMock.isDesktopLayout = false;
const { rerender } = render(
<PlatformEntryFlowShellImpl
selectionStage="platform"
setSelectionStage={vi.fn()}
/>,
);
expect(screen.getByRole('dialog', { name: '欢迎' })).toBeTruthy();
expect(
screen.getByText(
'尼嚎,新陶泥er!移动端仅支持作品展示体验创作工具请使用电脑端访问该地址',
),
).toBeTruthy();
expect(
document
.querySelector('.platform-mobile-home-welcome-dialog__icon')
?.getAttribute('src'),
).toBe('/branding/mobile-home-welcome-taonier-ip.png');
fireEvent.click(screen.getByRole('button', { name: '好' }));
expect(screen.queryByRole('dialog', { name: '欢迎' })).toBeNull();
expect(await screen.findByRole('main', { name: '我的' })).toBeTruthy();
const navigation = screen.getByRole('navigation', {
name: '移动平台导航',
});
expect(
within(navigation)
.getByRole('button', { name: '我的' })
.getAttribute('aria-current'),
).toBe('page');
rerender(
<PlatformEntryFlowShellImpl
selectionStage="profile"
setSelectionStage={vi.fn()}
/>,
);
expect(screen.queryByRole('dialog', { name: '欢迎' })).toBeNull();
});
it.each(['creation-home', 'project', 'image-editor'] as const)(
'shows the desktop guide instead of mounting the %s page on mobile',
async (selectionStage) => {
@@ -241,6 +292,7 @@ describe('PlatformEntryActiveFlowShell', () => {
expect(
await screen.findByRole('main', { name: '桌面端创作提示' }),
).toBeTruthy();
expect(screen.getByText('请在桌面端打开创作主页')).toBeTruthy();
expect(
screen.queryByRole('main', { name: '陶泥儿创作主页' }),
).toBeNull();
@@ -248,24 +300,44 @@ describe('PlatformEntryActiveFlowShell', () => {
expect(
screen.queryByRole('main', { name: '图片画布编辑器' }),
).toBeNull();
const navigation = screen.getByRole('navigation', {
name: '移动平台导航',
});
expect(
within(navigation)
.getAllByRole('button')
.map((button) => button.getAttribute('aria-label')),
).toEqual(['我的']);
expect(
within(navigation)
.getByRole('button', { name: '我的' })
.getAttribute('aria-current'),
).toBeNull();
},
);
it('shows the desktop guide instead of the editor after opening a canvas tool from the mobile root', async () => {
it('returns from the mobile tool guide through the only profile tab', async () => {
responsiveMock.isDesktopLayout = false;
render(<StatefulPlatformEntryFlowShell initialStage="creation-home" />);
fireEvent.click(screen.getByRole('button', { name: '好' }));
const navigation = screen.getByRole('navigation', {
name: '移动平台导航',
});
fireEvent.click(within(navigation).getByRole('button', { name: '我的' }));
expect(window.location.pathname).toBe('/profile');
expect(await screen.findByRole('main', { name: '我的' })).toBeTruthy();
});
it('does not mount creation actions on the mobile root', async () => {
responsiveMock.isDesktopLayout = false;
render(<StatefulPlatformEntryFlowShell initialStage="platform" />);
fireEvent.click(
await screen.findByRole('button', { name: '打开音乐工具' }),
);
expect(
await screen.findByRole('main', { name: '桌面端创作提示' }),
).toBeTruthy();
expect(
screen.queryByRole('main', { name: '图片画布编辑器' }),
).toBeNull();
expect(await screen.findByRole('main', { name: '我的' })).toBeTruthy();
expect(screen.queryByRole('button', { name: '打开音乐工具' })).toBeNull();
expect(screen.queryByRole('main', { name: '陶泥儿创作主页' })).toBeNull();
});
it('switches between creation and projects and passes search to the active page', async () => {