refactor: remove manual refresh and search controls
This commit is contained in:
@@ -36,7 +36,8 @@ test('Upcoming shares the task-list hierarchy while keeping its date scope and n
|
||||
const inbox = (await bootstrapResponse.json()).lists.find((item: { is_inbox: boolean }) => item.is_inbox)
|
||||
expect(inbox).toBeTruthy()
|
||||
|
||||
for (const [title, days] of [['未来一天任务', 1], ['未来三天任务', 3]] as const) {
|
||||
const createdTitles = ['未来一天任务', '未来三天任务'] as const
|
||||
for (const [title, days] of [[createdTitles[0], 1], [createdTitles[1], 3]] as const) {
|
||||
const response = await mutate(request, baseURL!, '/api/v1/tasks', {
|
||||
method: 'POST',
|
||||
data: { title, list_id: inbox.id, due_at: futureDueAt(days), due_has_time: false },
|
||||
@@ -55,8 +56,9 @@ test('Upcoming shares the task-list hierarchy while keeping its date scope and n
|
||||
await expect(header.getByRole('switch', { name: '显示已完成' })).toBeVisible()
|
||||
await expect(page.locator('.list-section-heading')).toContainText('任务')
|
||||
await expect(page.getByRole('button', { name: '调整顺序' })).toHaveCount(0)
|
||||
await expect(page.locator('.task-row')).toHaveCount(2)
|
||||
await expect(page.locator('.task-row')).toContainText(['未来一天任务', '未来三天任务'])
|
||||
const createdRows = page.locator('.task-row').filter({ hasText: /未来一天任务|未来三天任务/ })
|
||||
await expect(createdRows).toHaveCount(2)
|
||||
await expect(createdRows).toContainText([...createdTitles])
|
||||
|
||||
const geometry = await page.evaluate(() => {
|
||||
const rect = (selector: string) => {
|
||||
@@ -67,14 +69,12 @@ test('Upcoming shares the task-list hierarchy while keeping its date scope and n
|
||||
viewportWidth: innerWidth,
|
||||
overflow: document.documentElement.scrollWidth - document.documentElement.clientWidth,
|
||||
header: rect('.list-page-context'),
|
||||
search: rect('.list-search-reveal'),
|
||||
section: rect('.list-section-heading'),
|
||||
list: rect('.task-list'),
|
||||
}
|
||||
})
|
||||
expect(geometry.overflow).toBe(0)
|
||||
expect(geometry.header.left).toBeCloseTo(geometry.search.left, 0)
|
||||
expect(geometry.search.left).toBeCloseTo(geometry.section.left, 0)
|
||||
expect(geometry.header.left).toBeCloseTo(geometry.section.left, 0)
|
||||
expect(geometry.section.left).toBeCloseTo(geometry.list.left, 0)
|
||||
expect(geometry.header.width).toBeCloseTo(geometry.list.width, 0)
|
||||
if (geometry.viewportWidth <= 720) {
|
||||
|
||||
Reference in New Issue
Block a user