fix: restore numeric habit progress bars
This commit is contained in:
@@ -77,6 +77,7 @@ test('boolean habits complete in place while paused and unscheduled rows explain
|
||||
if ((page.viewportSize()?.width ?? 0) <= 930) await bottomTab(page, '习惯').click()
|
||||
else await page.locator('.sidebar').getByRole('button', { name: '习惯', exact: true }).click()
|
||||
const booleanRow = page.locator('.habit-row').filter({ hasText: booleanName })
|
||||
await expect(booleanRow.getByRole('progressbar')).toHaveCount(0)
|
||||
const booleanCheck = booleanRow.getByRole('button', { name: `完成${booleanName}一次` })
|
||||
const checkGeometry = await booleanCheck.evaluate((element) => {
|
||||
const control = element.getBoundingClientRect()
|
||||
@@ -153,16 +154,17 @@ test('approved polish keeps dense rows, title-only memos, and unique detail titl
|
||||
const transparent = 'rgba(0, 0, 0, 0)'
|
||||
await expect(taskRow).toHaveCSS('background-color', transparent)
|
||||
await taskRow.hover()
|
||||
await expect(taskRow).toHaveCSS('background-color', transparent)
|
||||
await expect(taskRow).toHaveCSS('background-color', testInfo.project.name === 'desktop-1440' ? 'rgb(255, 248, 238)' : transparent)
|
||||
await taskRow.locator('.task-main').click()
|
||||
await expect(taskRow).toHaveClass(/selected/)
|
||||
await expect(taskRow).toHaveCSS('background-color', transparent)
|
||||
await expect(taskRow).toHaveCSS('background-color', 'rgb(255, 244, 229)')
|
||||
const taskDetail = page.getByRole('dialog', { name: '任务详情' })
|
||||
await expect(taskDetail.getByRole('button', { name: '保存更改' })).toBeEnabled()
|
||||
await page.keyboard.press('Escape')
|
||||
await taskDetail.getByRole('button', { name: '关闭详情' }).click()
|
||||
await expect(taskDetail).toBeHidden()
|
||||
|
||||
await bottomTab(page, '习惯').click()
|
||||
if ((page.viewportSize()?.width ?? 0) <= 930) await bottomTab(page, '习惯').click()
|
||||
else await page.locator('.sidebar').getByRole('button', { name: '习惯', exact: true }).click()
|
||||
const mobileHabitGeometry = await page.evaluate(() => {
|
||||
const heading = document.querySelector<HTMLElement>('.habit-section-heading')!.getBoundingClientRect()
|
||||
const list = document.querySelector<HTMLElement>('.habit-list')!.getBoundingClientRect()
|
||||
@@ -178,14 +180,29 @@ test('approved polish keeps dense rows, title-only memos, and unique detail titl
|
||||
await page.getByRole('button', { name: '添加习惯', exact: true }).click()
|
||||
const habitRow = page.locator('.habit-row').filter({ hasText: habitName })
|
||||
await expect(habitRow).toHaveCount(1)
|
||||
await expect(habitRow.getByRole('progressbar', { name: `${habitName}进度:0 / 8` })).toHaveAttribute('max', '8')
|
||||
await expect(habitRow.getByRole('progressbar', { name: `${habitName}进度:0 / 8` })).toHaveAttribute('value', '0')
|
||||
await expect(habitRow.locator('.habit-row-meta')).toHaveText('0 / 8')
|
||||
await expectHeightInRange(habitRow, 57, 59)
|
||||
await expectNotClipped(habitRow)
|
||||
await habitRow.getByRole('button', { name: `查看习惯详情:${habitName}` }).click()
|
||||
await habitRow.getByRole('button', { name: `完成${habitName}一次` }).click()
|
||||
await expect(habitRow.getByRole('progressbar', { name: `${habitName}进度:1 / 8` })).toHaveAttribute('value', '1')
|
||||
await expect(habitRow.locator('.habit-row-meta')).toHaveText('1 / 8')
|
||||
if ((page.viewportSize()?.width ?? 0) <= 930) await bottomTab(page, '今天').click()
|
||||
else await page.locator('.sidebar').getByRole('button', { name: '今天', exact: true }).click()
|
||||
const todayHabitRow = page.locator('.today-habit-row').filter({ hasText: habitName })
|
||||
await expect(todayHabitRow.getByRole('progressbar', { name: `${habitName}进度:1 / 8` })).toHaveAttribute('max', '8')
|
||||
await expect(todayHabitRow.getByRole('progressbar', { name: `${habitName}进度:1 / 8` })).toHaveAttribute('value', '1')
|
||||
await expect(todayHabitRow.locator('.habit-row-meta')).toHaveText('1 / 8')
|
||||
await expectHeightInRange(todayHabitRow, 57, 59)
|
||||
await expectNotClipped(todayHabitRow)
|
||||
await todayHabitRow.getByRole('button', { name: `查看习惯详情:${habitName}` }).click()
|
||||
const habitDetail = page.getByRole('dialog', { name: habitName })
|
||||
await expect(habitDetail.getByRole('heading', { name: habitName, exact: true })).toHaveCount(1)
|
||||
await expect(habitDetail).not.toContainText('习惯详情')
|
||||
await habitDetail.getByRole('button', { name: '关闭习惯详情' }).click()
|
||||
await page.setViewportSize({ width: 1440, height: 900 })
|
||||
await page.locator('.sidebar').getByRole('button', { name: '习惯', exact: true }).click()
|
||||
const desktopHabitGeometry = await page.evaluate(() => {
|
||||
const view = document.querySelector<HTMLElement>('main.list-main > .mvp-view')!.getBoundingClientRect()
|
||||
const heading = document.querySelector<HTMLElement>('.habit-section-heading')!.getBoundingClientRect()
|
||||
|
||||
Reference in New Issue
Block a user