fix(canvas): restore left project sidebar
This commit is contained in:
@@ -125,16 +125,12 @@ describe('AI Design Canvas page', () => {
|
||||
expect(screen.queryByText(/规格版本|编译器|生成策略|字段决策/)).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('renders the Workspace list as a full-height right Works rail on desktop', () => {
|
||||
it('leaves desktop Workspace navigation to the shared left project sidebar', () => {
|
||||
setViewport(true);
|
||||
prepareWorkspace();
|
||||
render(<ImageCanvas />);
|
||||
|
||||
const rail = screen.getByTestId('image-workspace-works-rail');
|
||||
expect(rail).toBeInTheDocument();
|
||||
expect(within(rail).getByRole('heading', { name: '我的作品' })).toBeInTheDocument();
|
||||
expect(within(rail).getByRole('button', { name: '打开作品 咖啡机新品主视觉' })).toBeInTheDocument();
|
||||
expect(within(rail).getByRole('button', { name: '新建作品' })).toBeInTheDocument();
|
||||
expect(screen.queryByTestId('image-workspace-works-rail')).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole('button', { name: '作品' })).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
@@ -146,16 +142,19 @@ describe('AI Design Canvas page', () => {
|
||||
render(<ImageCanvas />);
|
||||
|
||||
expect(screen.getByText(/制作方案已准备好,确认前仍可修改/)).toBeInTheDocument();
|
||||
expect(within(screen.getByTestId('image-workspace-works-rail')).getByText('待确认')).toBeInTheDocument();
|
||||
expect(screen.queryByTestId('image-workspace-works-rail')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('opens the Works rail as a right sheet on compact layouts', () => {
|
||||
it('opens the Works rail as a left sheet on compact layouts', () => {
|
||||
prepareWorkspace();
|
||||
render(<ImageCanvas />);
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: '作品' }));
|
||||
expect(screen.getByTestId('image-workspace-works-rail')).toBeInTheDocument();
|
||||
expect(within(screen.getByTestId('image-workspace-works-rail')).getByRole('heading', { name: '我的作品' })).toBeInTheDocument();
|
||||
const rail = screen.getByTestId('image-workspace-works-rail');
|
||||
expect(rail).toBeInTheDocument();
|
||||
expect(within(rail).getByRole('heading', { name: '我的作品' })).toBeInTheDocument();
|
||||
expect(rail.closest('[role="dialog"]')).toHaveClass('left-0');
|
||||
expect(rail.closest('[role="dialog"]')).not.toHaveClass('right-0');
|
||||
});
|
||||
|
||||
it('shows one unfinished assistant reply incrementally and replaces it with the canonical turn', async () => {
|
||||
|
||||
@@ -7,19 +7,18 @@ import { useSettingsStore } from '@/stores/settings';
|
||||
const routeRenderMock = vi.hoisted(() => vi.fn());
|
||||
|
||||
vi.mock('@/components/layout/Sidebar', () => ({
|
||||
Sidebar: ({ sidebarCollapsedOverride }: { sidebarCollapsedOverride?: boolean }) => (
|
||||
<aside data-testid="sidebar-stub" data-sidebar-collapsed={sidebarCollapsedOverride === undefined ? 'unset' : String(sidebarCollapsedOverride)} />
|
||||
Sidebar: ({ hideOnCompact = false }: { hideOnCompact?: boolean }) => (
|
||||
<aside data-testid="sidebar-stub" data-hide-on-compact={String(hideOnCompact)} />
|
||||
),
|
||||
}));
|
||||
vi.mock('@/components/layout/TitleBar', () => ({
|
||||
TitleBar: ({ integrated = false, overlay = false, showSidebarControls = true, pageTitle, sidebarCollapsedOverride }: { integrated?: boolean; overlay?: boolean; showSidebarControls?: boolean; pageTitle?: string; sidebarCollapsedOverride?: boolean }) => (
|
||||
TitleBar: ({ integrated = false, overlay = false, showSidebarControls = true, pageTitle }: { integrated?: boolean; overlay?: boolean; showSidebarControls?: boolean; pageTitle?: string }) => (
|
||||
<header
|
||||
data-testid="titlebar-stub"
|
||||
data-integrated={integrated ? 'true' : 'false'}
|
||||
data-overlay={overlay ? 'true' : 'false'}
|
||||
data-sidebar-controls={showSidebarControls ? 'true' : 'false'}
|
||||
data-page-title={pageTitle ?? ''}
|
||||
data-sidebar-collapsed={sidebarCollapsedOverride === undefined ? 'unset' : String(sidebarCollapsedOverride)}
|
||||
/>
|
||||
),
|
||||
}));
|
||||
@@ -54,14 +53,14 @@ describe('MainLayout module isolation', () => {
|
||||
expect(screen.queryByTestId('project-initialization-gate')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('uses the full-height workspace shell for AI painting', () => {
|
||||
it('uses the full-height workspace shell with the shared left project sidebar for AI painting', () => {
|
||||
renderLayout('/image-canvas');
|
||||
|
||||
expect(screen.getByTestId('main-content')).toHaveClass('basis-0', 'h-full', 'overflow-hidden', 'p-0');
|
||||
expect(screen.getByTestId('main-content')).not.toHaveClass('p-5', 'sm:p-6');
|
||||
expect(screen.getByTestId('titlebar-stub')).toHaveAttribute('data-overlay', 'true');
|
||||
expect(screen.getByTestId('titlebar-stub')).toHaveAttribute('data-sidebar-controls', 'false');
|
||||
expect(screen.queryByTestId('sidebar-stub')).not.toBeInTheDocument();
|
||||
expect(screen.getByTestId('titlebar-stub')).toHaveAttribute('data-sidebar-controls', 'true');
|
||||
expect(screen.getByTestId('sidebar-stub')).toHaveAttribute('data-hide-on-compact', 'true');
|
||||
});
|
||||
|
||||
it('does not overlay the local project initialization gate on AI hardware', () => {
|
||||
|
||||
Reference in New Issue
Block a user