完善客户端模块与工作区能力
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-13 19:45:30 +08:00
parent 0148b91a15
commit 22add3f01f
97 changed files with 4756 additions and 3226 deletions

View File

@@ -27,7 +27,7 @@ describe('AI module navigation', () => {
useOpencodeStore.setState({ activeProject: null });
});
it('shows the three module choices and routes enabled modules from the chooser', async () => {
it('shows the four module choices and routes enabled modules from the chooser', async () => {
render(
<MemoryRouter initialEntries={['/module-select']}>
<Routes>
@@ -40,8 +40,9 @@ describe('AI module navigation', () => {
expect(screen.getByTestId('ai-module-selection-page')).toBeInTheDocument();
expect(screen.getByRole('heading', { name: '今天,想创作什么?' })).toBeInTheDocument();
expect(screen.getByRole('heading', { name: '今天,想创作什么?' })).toHaveClass('whitespace-nowrap');
expect(screen.getByTestId('ai-module-options')).toHaveClass('module-selection-options');
expect(screen.getByText('zhangsan欢迎回来')).toBeInTheDocument();
expect(screen.getByTestId('ai-module-option-programming')).toHaveClass('module-option-card');
expect(screen.getByTestId('ai-module-option-programming')).toHaveClass('module-option-card', 'module-option-card-horizontal');
expect(screen.queryByText('先选一个入口。进入后,你还可以从左下角随时切换到其他模块。')).not.toBeInTheDocument();
expect(screen.queryByText('选择创作空间。你可以随时从侧边栏切换。')).not.toBeInTheDocument();
expect(screen.getByAltText('Makelore')).toHaveClass('h-8', 'w-40', 'object-cover');
@@ -60,6 +61,13 @@ describe('AI module navigation', () => {
expect(learningOption).toHaveTextContent('用顶尖的方法解锁万物规律');
expect(learningOption).toHaveTextContent('暂未开放');
expect(screen.getByAltText('数学科技宇宙')).toBeInTheDocument();
const robotOption = screen.getByTestId('ai-module-option-robot');
expect(robotOption).toBeDisabled();
expect(robotOption).toHaveClass('module-option-card-disabled');
expect(robotOption).toHaveTextContent('Robot 机器');
expect(robotOption).toHaveTextContent('制作你的第一个机器人小伙伴');
expect(robotOption).toHaveTextContent('暂未开放');
expect(screen.getByAltText('青少年管理机器人硬件与设备绑定')).toBeInTheDocument();
fireEvent.click(screen.getByTestId('ai-module-option-painting'));
expect(await screen.findByTestId('location-path')).toHaveTextContent('/image-canvas');
@@ -131,6 +139,13 @@ describe('AI module navigation', () => {
fireEvent.click(learningModule);
expect(screen.getByTestId('location-path')).toHaveTextContent('/image-canvas');
const robotModule = screen.getByTestId('sidebar-module-robot');
expect(robotModule).toBeDisabled();
expect(robotModule).toHaveTextContent('Robot 机器');
expect(robotModule).toHaveTextContent('AI 机器');
fireEvent.click(robotModule);
expect(screen.getByTestId('location-path')).toHaveTextContent('/image-canvas');
fireEvent.click(screen.getByTestId('sidebar-module-programming'));
expect(await screen.findByTestId('location-path')).toHaveTextContent('/opencode-chat');
});