fix(agents): open cards from home and align sidebar navigation

This commit is contained in:
鲨鱼辣椒 committed 2026-10-12 20:06:22 +08:00
1 parent e5d79bf37a
commit 5e99804bc2
13 files changed
+460 -27

No files matched your search

+6 -2
View File
@@ -23,11 +23,12 @@ vi.mock('@/components/layout/Sidebar', () => ({
),
}));
vi.mock('@/components/layout/TitleBar', () => ({
TitleBar: ({ integrated = false, overlay = false, showSidebarControls = true, pageTitle, sidebarPeekOpen = false, onSidebarPeekChange }: {
TitleBar: ({ integrated = false, overlay = false, showSidebarControls = true, pageTitle, showModuleReturn = false, sidebarPeekOpen = false, onSidebarPeekChange }: {
integrated?: boolean;
overlay?: boolean;
showSidebarControls?: boolean;
pageTitle?: string;
showModuleReturn?: boolean;
sidebarPeekOpen?: boolean;
onSidebarPeekChange?: (open: boolean, source: 'toggle' | 'focus' | 'sidebar' | 'titlebar') => void;
}) => (
@@ -37,6 +38,7 @@ vi.mock('@/components/layout/TitleBar', () => ({
data-overlay={overlay ? 'true' : 'false'}
data-sidebar-controls={showSidebarControls ? 'true' : 'false'}
data-page-title={pageTitle ?? ''}
data-module-return={String(showModuleReturn)}
data-peek-open={String(sidebarPeekOpen)}
data-has-peek-handler={String(Boolean(onSidebarPeekChange))}
/>
@@ -93,8 +95,9 @@ describe('MainLayout module isolation', () => {
renderLayout('/cloud-agents');
expect(screen.getByTestId('main-content')).toHaveClass('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-page-title', '智能体工作区');
expect(screen.getByTestId('titlebar-stub')).toHaveAttribute('data-page-title', '我的智能体');
expect(screen.getByTestId('titlebar-stub')).toHaveAttribute('data-overlay', 'false');
expect(screen.getByTestId('titlebar-stub')).toHaveAttribute('data-module-return', 'true');
expect(screen.getByTestId('sidebar-stub')).toHaveAttribute('data-hide-on-compact', 'false');
});
@@ -110,6 +113,7 @@ describe('MainLayout module isolation', () => {
expect(screen.getByTestId('route-content')).toBeVisible();
expect(screen.queryByTestId('project-initialization-gate')).not.toBeInTheDocument();
expect(screen.getByTestId('titlebar-stub')).toHaveAttribute('data-module-return', 'false');
expect(screen.getByTestId('titlebar-stub')).toHaveAttribute('data-overlay', 'false');
});