style: 颜色统一为CSS变量并优化复习卡片交互

This commit is contained in:
2026-09-13 22:11:23 +08:00
parent cc4c20e77b
commit fae27e7c20
12 changed files with 372 additions and 100 deletions
+23 -3
View File
@@ -41,12 +41,14 @@ test.describe('Review page', () => {
await page.waitForSelector('.review-page', { timeout: 10_000 });
});
test('displays summary metrics and task table', async ({ page }) => {
test('displays summary metrics and task list', async ({ page }) => {
await expect(page.locator('.metric-card')).toHaveCount(3);
// Check metric values
await expect(page.locator('.metric-card').first().locator('strong')).toContainText('2');
// Check table rows
await expect(page.locator('.el-table__row')).toHaveCount(2);
// 任务以卡片列表展示(不再是 el-table)
await expect(page.locator('.task-card')).toHaveCount(2);
await expect(page.getByText('学习 Vue3')).toBeVisible();
await expect(page.getByRole('button', { name: '回忆复习' })).toHaveCount(2);
});
test('shows empty state when no tasks', async ({ page }) => {
@@ -61,5 +63,23 @@ test.describe('Review page', () => {
await page.goto('/review');
await page.waitForSelector('.review-page', { timeout: 10_000 });
await expect(page.locator('.metric-card').first().locator('strong')).toContainText('0');
await expect(page.getByText('暂无复习任务')).toBeVisible();
});
test('接口失败时提示加载失败而不是显示空列表', async ({ page }) => {
await page.route('**/api/review/tasks**', (route) =>
route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({ code: 500, message: '服务异常', data: null }),
}),
);
await page.goto('/review');
await page.waitForSelector('.review-page', { timeout: 10_000 });
await expect(page.getByText('复习数据加载失败,请稍后重试')).toBeVisible();
await expect(page.getByRole('button', { name: '重新加载' })).toBeVisible();
await expect(page.getByText('暂无复习任务')).toHaveCount(0);
});
});