fix: align numeric habit progress
This commit is contained in:
@@ -185,6 +185,16 @@ test('approved polish keeps dense rows, title-only memos, and unique detail titl
|
||||
await expect(habitRow.locator('.habit-row-meta')).toHaveText('0 / 8')
|
||||
await expectHeightInRange(habitRow, 57, 59)
|
||||
await expectNotClipped(habitRow)
|
||||
const habitVerticalLayout = await habitRow.evaluate((row) => {
|
||||
const rowBox = row.getBoundingClientRect()
|
||||
const titleBox = row.querySelector<HTMLElement>('.habit-name')!.getBoundingClientRect()
|
||||
const progressBox = row.querySelector<HTMLElement>('.habit-progress-bar')!.getBoundingClientRect()
|
||||
const groupCenter = (titleBox.top + progressBox.bottom) / 2
|
||||
return { groupOffset: groupCenter - (rowBox.top + rowBox.height / 2), progressBottomGap: rowBox.bottom - progressBox.bottom }
|
||||
})
|
||||
expect(habitVerticalLayout.groupOffset).toBeGreaterThanOrEqual(-2)
|
||||
expect(habitVerticalLayout.groupOffset).toBeLessThanOrEqual(2)
|
||||
expect(habitVerticalLayout.progressBottomGap).toBeGreaterThanOrEqual(12)
|
||||
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')
|
||||
|
||||
Reference in New Issue
Block a user