fix: align numeric habit progress
ci / gitleaks (push) Successful in 7s
ci / docker (push) Successful in 3m38s

This commit is contained in:
2026-09-20 06:58:03 +08:00
parent 0fb98e894e
commit a877d341f7
3 changed files with 14 additions and 2 deletions
+10
View File
@@ -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')