优化创作主页ui表现
收窄创作主页和项目页共用的左侧导航栏与顶部搜索栏 压缩导航按钮、搜索框、泥点入口和账号入口的内部间距 修复项目页切换后创作入口仍保留主按钮样式的问题 补充项目页导航默认态的文档与回归测试
This commit is contained in:
@@ -9195,9 +9195,21 @@ test('project page keeps desktop rail and can return to platform tabs', async ()
|
||||
expect(await screen.findByRole('main', { name: '项目' })).toBeTruthy();
|
||||
const nav = container.querySelector('.platform-desktop-rail');
|
||||
expect(nav).toBeTruthy();
|
||||
expect(
|
||||
within(nav as HTMLElement).getByRole('button', { name: '项目' }),
|
||||
).toBeTruthy();
|
||||
const createNavButton = within(nav as HTMLElement).getByRole('button', {
|
||||
name: '创作',
|
||||
});
|
||||
const projectNavButton = within(nav as HTMLElement).getByRole('button', {
|
||||
name: '项目',
|
||||
});
|
||||
expect(projectNavButton.className).toContain(
|
||||
'platform-desktop-rail__button--active',
|
||||
);
|
||||
expect(createNavButton.className).not.toContain(
|
||||
'platform-desktop-rail__button--active',
|
||||
);
|
||||
expect(createNavButton.className).not.toContain(
|
||||
'platform-desktop-rail__button--primary',
|
||||
);
|
||||
|
||||
await user.click(within(nav as HTMLElement).getByRole('button', { name: '推荐' }));
|
||||
|
||||
@@ -9207,6 +9219,38 @@ test('project page keeps desktop rail and can return to platform tabs', async ()
|
||||
expect(window.location.pathname).toBe('/');
|
||||
});
|
||||
|
||||
test('desktop project tab switch clears creation primary styling', async () => {
|
||||
const user = userEvent.setup();
|
||||
mockDesktopPlatformLayout();
|
||||
window.history.replaceState(null, '', '/creation');
|
||||
const { container } = render(<TestWrapper withAuth />);
|
||||
|
||||
await screen.findByRole('main', { name: '陶泥儿创作主页' });
|
||||
const nav = container.querySelector('.platform-desktop-rail');
|
||||
expect(nav).toBeTruthy();
|
||||
|
||||
await user.click(within(nav as HTMLElement).getByRole('button', { name: '项目' }));
|
||||
|
||||
expect(await screen.findByRole('main', { name: '项目' })).toBeTruthy();
|
||||
const projectNav = container.querySelector('.platform-desktop-rail');
|
||||
expect(projectNav).toBeTruthy();
|
||||
const createNavButton = within(projectNav as HTMLElement).getByRole('button', {
|
||||
name: '创作',
|
||||
});
|
||||
const projectNavButton = within(projectNav as HTMLElement).getByRole('button', {
|
||||
name: '项目',
|
||||
});
|
||||
expect(projectNavButton.className).toContain(
|
||||
'platform-desktop-rail__button--active',
|
||||
);
|
||||
expect(createNavButton.className).not.toContain(
|
||||
'platform-desktop-rail__button--active',
|
||||
);
|
||||
expect(createNavButton.className).not.toContain(
|
||||
'platform-desktop-rail__button--primary',
|
||||
);
|
||||
});
|
||||
|
||||
test('direct mobile creation home keeps landing content without mobile nav entry', async () => {
|
||||
window.history.replaceState(null, '', '/creation');
|
||||
const { container } = render(<TestWrapper withAuth />);
|
||||
|
||||
@@ -5037,7 +5037,7 @@ export function RpgEntryHomeView({
|
||||
label={tabLabels[tab]}
|
||||
icon={tabIcons[tab]}
|
||||
creationHomeIconSrc={CREATION_HOME_NAV_ICON_SRC[tab]}
|
||||
emphasized={tab === 'create'}
|
||||
emphasized={tab === 'create' && resolvedDesktopNavTab === 'create'}
|
||||
showDot={false}
|
||||
disabled={isRechargePaymentConfirmationPending}
|
||||
onClick={() => {
|
||||
|
||||
Reference in New Issue
Block a user