feat: remove Learning module
This commit is contained in:
@@ -52,7 +52,7 @@ describe('AI module navigation', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('shows the four module choices and routes Canvas from the chooser', async () => {
|
||||
it('shows only the three supported module choices and routes Canvas from the chooser', async () => {
|
||||
render(
|
||||
<MemoryRouter initialEntries={['/module-select']}>
|
||||
<Routes>
|
||||
@@ -68,9 +68,11 @@ describe('AI module navigation', () => {
|
||||
expect(screen.getByTestId('ai-module-options')).toHaveClass('module-selection-options');
|
||||
expect(await screen.findByText('小明,欢迎回来!')).toBeInTheDocument();
|
||||
expect(screen.getByTestId('ai-module-option-programming')).toHaveClass('module-option-card', 'module-option-card-horizontal');
|
||||
for (const moduleId of ['programming', 'painting', 'learning', 'robot'] as const) {
|
||||
for (const moduleId of ['programming', 'painting', 'robot'] as const) {
|
||||
expect(screen.getByTestId(`ai-module-option-${moduleId}`).querySelector('.module-option-artwork')).toBeNull();
|
||||
}
|
||||
expect(screen.getAllByTestId(/^ai-module-option-/u)).toHaveLength(3);
|
||||
expect(screen.queryByTestId('ai-module-option-learning')).not.toBeInTheDocument();
|
||||
expect(screen.queryByText('先选一个入口。进入后,你还可以从左下角随时切换到其他模块。')).not.toBeInTheDocument();
|
||||
expect(screen.queryByText('选择创作空间。你可以随时从侧边栏切换。')).not.toBeInTheDocument();
|
||||
expect(screen.getByAltText('Makelore')).toHaveClass('h-8', 'w-40', 'object-cover');
|
||||
@@ -82,12 +84,6 @@ describe('AI module navigation', () => {
|
||||
expect(screen.getByText('Canvas 设计')).toBeInTheDocument();
|
||||
expect(screen.getByAltText('数位板设计创作')).toBeInTheDocument();
|
||||
expect(screen.getByTestId('ai-module-option-painting')).toHaveTextContent('用灵感描绘色彩缤纷的世界');
|
||||
const learningOption = screen.getByTestId('ai-module-option-learning');
|
||||
expect(learningOption).toBeEnabled();
|
||||
expect(learningOption).not.toHaveClass('module-option-card-disabled');
|
||||
expect(learningOption).toHaveTextContent('Learning 学习');
|
||||
expect(learningOption).toHaveTextContent('用顶尖的方法解锁万物规律');
|
||||
expect(screen.getByAltText('数学科技宇宙')).toBeInTheDocument();
|
||||
const robotOption = screen.getByTestId('ai-module-option-robot');
|
||||
expect(robotOption).toBeEnabled();
|
||||
expect(robotOption).not.toHaveClass('module-option-card-disabled');
|
||||
@@ -95,8 +91,8 @@ describe('AI module navigation', () => {
|
||||
expect(robotOption).toHaveTextContent('制作你的第一个机器人小伙伴');
|
||||
expect(screen.getByAltText('青少年管理机器人硬件与设备绑定')).toBeInTheDocument();
|
||||
|
||||
fireEvent.click(learningOption);
|
||||
expect(await screen.findByTestId('location-path')).toHaveTextContent('/learning');
|
||||
fireEvent.click(screen.getByTestId('ai-module-option-painting'));
|
||||
expect(await screen.findByTestId('location-path')).toHaveTextContent('/image-canvas');
|
||||
});
|
||||
|
||||
it('routes Robot from the chooser to the AI hardware workspace', async () => {
|
||||
@@ -117,8 +113,7 @@ describe('AI module navigation', () => {
|
||||
useAuthStore.setState({
|
||||
moduleAccess: {
|
||||
programming: true,
|
||||
design: true,
|
||||
learning: false,
|
||||
design: false,
|
||||
robot: true,
|
||||
},
|
||||
user: {
|
||||
@@ -139,12 +134,12 @@ describe('AI module navigation', () => {
|
||||
</MemoryRouter>,
|
||||
);
|
||||
|
||||
const learningOption = screen.getByTestId('ai-module-option-learning');
|
||||
expect(learningOption).toBeDisabled();
|
||||
expect(learningOption).toHaveClass('module-option-card-disabled');
|
||||
expect(learningOption).toHaveAttribute('aria-disabled', 'true');
|
||||
const canvasOption = screen.getByTestId('ai-module-option-painting');
|
||||
expect(canvasOption).toBeDisabled();
|
||||
expect(canvasOption).toHaveClass('module-option-card-disabled');
|
||||
expect(canvasOption).toHaveAttribute('aria-disabled', 'true');
|
||||
|
||||
fireEvent.click(learningOption);
|
||||
fireEvent.click(canvasOption);
|
||||
expect(screen.getByTestId('ai-module-selection-page')).toBeInTheDocument();
|
||||
expect(screen.queryByTestId('location-path')).not.toBeInTheDocument();
|
||||
});
|
||||
@@ -274,20 +269,6 @@ describe('AI module navigation', () => {
|
||||
expect(await screen.findByTestId('location-path')).toHaveTextContent('/module-select');
|
||||
});
|
||||
|
||||
it('shows Learning as the active module and returns to the chooser from the learning route', async () => {
|
||||
render(
|
||||
<MemoryRouter initialEntries={['/learning']}>
|
||||
<Routes>
|
||||
<Route path="*" element={<><ModuleSwitcher sidebarCollapsed={false} /><LocationProbe /></>} />
|
||||
</Routes>
|
||||
</MemoryRouter>,
|
||||
);
|
||||
|
||||
expect(screen.getByTestId('sidebar-module-switcher-trigger')).toHaveTextContent('学习 Learning');
|
||||
fireEvent.click(screen.getByTestId('sidebar-module-switcher-trigger'));
|
||||
expect(await screen.findByTestId('location-path')).toHaveTextContent('/module-select');
|
||||
});
|
||||
|
||||
it('keeps breathing room around the compact module switcher trigger', () => {
|
||||
render(
|
||||
<MemoryRouter initialEntries={['/chat']}>
|
||||
|
||||
Reference in New Issue
Block a user