收口 Makelore 客户端变更
Some checks failed
Electron E2E / Electron E2E (macos-latest) (push) Has been cancelled
Electron E2E / Electron E2E (ubuntu-latest) (push) Has been cancelled
Electron E2E / Electron E2E (windows-latest) (push) Has been cancelled

This commit is contained in:
inman
2026-08-12 22:35:06 +08:00
parent 253bad8b40
commit f4113a872f
232 changed files with 4617 additions and 20121 deletions

View File

@@ -106,7 +106,7 @@ describe('Sidebar project initialization flow', () => {
const createProject = screen.getByTestId('sidebar-create-project');
expect(createProject).toHaveTextContent('新建项目');
expect(createProject).toHaveClass('bg-transparent', 'border-0', 'shadow-none');
expect(screen.getByTestId('sidebar')).toHaveClass('border-r', 'bg-surface-sidebar');
expect(screen.getByTestId('sidebar')).toHaveClass('border-r', 'sidebar-glass-surface');
expect(screen.queryByTestId('sidebar-nav-asset-square')).not.toBeInTheDocument();
expect(screen.queryByTestId('sidebar-nav-project-config')).not.toBeInTheDocument();
expect(screen.queryByTestId('sidebar-nav-agent-chat')).not.toBeInTheDocument();
@@ -119,7 +119,8 @@ describe('Sidebar project initialization flow', () => {
expect(moduleTrigger).toHaveClass('w-fit', 'justify-start', 'gap-1');
expect(moduleTrigger).not.toHaveClass('bg-brand-soft');
expect(moduleTrigger).toHaveTextContent('编程 Code');
expect(screen.queryByTestId('sidebar-module-programming')).not.toBeInTheDocument();
expect(screen.getByTestId('sidebar-module-switcher-menu')).toHaveAttribute('data-state', 'closed');
expect(screen.getByTestId('sidebar-module-programming')).toBeInTheDocument();
fireEvent.click(screen.getByTestId('sidebar-module-switcher-trigger'));
const programmingModule = screen.getByTestId('sidebar-module-programming');
expect(programmingModule).toHaveTextContent('编程 Code');
@@ -162,13 +163,14 @@ describe('Sidebar project initialization flow', () => {
fireEvent.click(account);
const menu = screen.getByTestId('sidebar-account-menu');
expect(menu).toHaveClass('absolute', 'left-0', 'w-full', 'overflow-y-auto');
expect(menu).toHaveClass('max-h-[calc(100vh-7rem)]');
expect(menu).toHaveAttribute('data-state', 'open');
expect(menu).toHaveClass('absolute', 'left-0', 'w-full');
expect(menu.querySelector('.codex-disclosure-inner')).toHaveClass('max-h-[calc(100vh-7rem)]', 'overflow-y-auto');
expect(menu).not.toHaveClass('fixed');
const usageItem = screen.getByTestId('sidebar-account-usage-menuitem');
expect(usageItem).toHaveClass('min-h-8');
expect(screen.queryByTestId('sidebar-account-usage-drawer')).not.toBeInTheDocument();
expect(screen.getByTestId('sidebar-account-usage-drawer')).toHaveAttribute('data-state', 'closed');
fireEvent.click(usageItem);
const usageDrawer = screen.getByTestId('sidebar-account-usage-drawer');
@@ -196,7 +198,8 @@ describe('Sidebar project initialization flow', () => {
);
const sidebar = screen.getByTestId('sidebar');
expect(sidebar).toHaveClass('w-0', 'pointer-events-none', 'opacity-0');
expect(sidebar).toHaveClass('w-0', 'pointer-events-none', 'opacity-0', 'fixed', 'inset-y-0', 'left-0', 'z-[350]');
expect(sidebar).not.toHaveClass('sidebar-peek-surface', 'pt-10');
rerender(
<MemoryRouter>
@@ -204,12 +207,25 @@ describe('Sidebar project initialization flow', () => {
</MemoryRouter>,
);
expect(sidebar).toHaveClass('w-64', 'absolute', 'shadow-float');
expect(sidebar).toHaveClass('w-64', 'fixed', 'inset-y-0', 'z-[350]', 'sidebar-peek-surface', 'pt-10', 'shadow-float');
expect(screen.getByTestId('sidebar-create-project')).toHaveTextContent('新建项目');
fireEvent.pointerEnter(sidebar);
expect(onSidebarPeekChange).toHaveBeenCalledWith(true);
expect(onSidebarPeekChange).toHaveBeenCalledWith(true, 'sidebar');
fireEvent.pointerLeave(sidebar);
expect(onSidebarPeekChange).toHaveBeenCalledWith(false);
expect(onSidebarPeekChange).toHaveBeenCalledWith(false, 'sidebar');
});
it('keeps a clicked-open sidebar on the translucent blurred material', () => {
useSettingsStore.setState({ sidebarCollapsed: false });
render(
<MemoryRouter>
<Sidebar />
</MemoryRouter>,
);
const sidebar = screen.getByTestId('sidebar');
expect(sidebar).toHaveClass('w-64', 'sidebar-glass-surface');
expect(sidebar).not.toHaveClass('fixed', 'sidebar-peek-surface', 'pt-10');
});
it('shows an available update beside the lower-left account control', async () => {
@@ -316,7 +332,10 @@ describe('Sidebar project initialization flow', () => {
render(<MemoryRouter><Sidebar /></MemoryRouter>);
fireEvent.click(await screen.findByRole('button', { name: `进入项目 ${project.name}` }));
expect(await screen.findByTestId('project-config-error')).toBeInTheDocument();
const projectConfigError = await screen.findByTestId('project-config-error');
expect(projectConfigError).toBeInTheDocument();
expect(screen.getByTestId('project-config-error-overlay')).toHaveClass('fixed', 'inset-0', 'backdrop-blur-md');
expect(projectConfigError.closest('[data-testid="sidebar"]')).toBeNull();
fireEvent.click(screen.getByRole('button', { name: '移除项目卡片' }));
const removeDialog = screen.getByRole('dialog', { name: `移除项目“${project.name}”?` });
expect(removeDialog).toBeInTheDocument();
@@ -332,7 +351,7 @@ describe('Sidebar project initialization flow', () => {
expect(useProjectConfigStore.getState().configsByProjectId[project.id]).toBeUndefined();
});
it('shows project identity with an explicit enter action', async () => {
it('uses the whole project card as the enter action', async () => {
const project = { id: 'prj_config', path: 'D:/repo/config', name: 'config', createdAt: '', updatedAt: '', lastOpenedAt: '' };
const config = {
...createProjectConfig(),
@@ -364,7 +383,8 @@ describe('Sidebar project initialization flow', () => {
expect(screen.getByLabelText('项目 Agent').children).toHaveLength(4);
expect(screen.getByTitle('小策').querySelector('img')).toHaveAttribute('src', getAgentAvatarSrc('avatar-16'));
expect(screen.getByTitle('小设').querySelector('img')).toHaveAttribute('src', getAgentAvatarSrc('avatar-15'));
expect(screen.getByRole('button', { name: `进入项目 ${project.name}` })).toHaveTextContent('进入项目');
expect(screen.getByRole('button', { name: `进入项目 ${project.name}` })).toBe(card);
expect(card.querySelectorAll('button')).toHaveLength(0);
expect(screen.queryByRole('button', { name: `配置项目 ${project.name}` })).not.toBeInTheDocument();
});