fix: align habit section heading width
ci / gitleaks (push) Successful in 7s
ci / docker (push) Successful in 5m53s

This commit is contained in:
2026-09-18 11:18:05 +08:00
parent 978c4b87ed
commit 87c8831fdb
3 changed files with 20 additions and 0 deletions
+18
View File
@@ -175,6 +175,13 @@ test('approved polish keeps search state, dense rows, title-only memos, and uniq
await expect(searchInput).toHaveValue(`搜索保留-${suffix}`)
await bottomTab(page, '习惯').click()
const mobileHabitGeometry = await page.evaluate(() => {
const heading = document.querySelector<HTMLElement>('.habit-section-heading')!.getBoundingClientRect()
const list = document.querySelector<HTMLElement>('.habit-list')!.getBoundingClientRect()
return { headingWidth: heading.width, listWidth: list.width, headingLeft: heading.left, listLeft: list.left }
})
expect(mobileHabitGeometry.headingWidth).toBeCloseTo(mobileHabitGeometry.listWidth, 0)
expect(mobileHabitGeometry.headingLeft).toBeCloseTo(mobileHabitGeometry.listLeft, 0)
const habitName = `长标题习惯-${suffix}-检查进度与按钮不被裁切`
await page.getByRole('button', { name: '添加习惯' }).click()
await page.getByLabel('新习惯名称').fill(habitName)
@@ -190,6 +197,17 @@ test('approved polish keeps search state, dense rows, title-only memos, and uniq
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 })
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()
const list = document.querySelector<HTMLElement>('.habit-list')!.getBoundingClientRect()
return { viewWidth: view.width, headingWidth: heading.width, listWidth: list.width, headingLeft: heading.left, listLeft: list.left }
})
expect(desktopHabitGeometry.viewWidth).toBeGreaterThan(630)
expect(desktopHabitGeometry.headingWidth).toBeCloseTo(desktopHabitGeometry.listWidth, 0)
expect(desktopHabitGeometry.headingLeft).toBeCloseTo(desktopHabitGeometry.listLeft, 0)
await page.setViewportSize({ width: testInfo.project.name === 'mobile-390' ? 390 : 375, height: testInfo.project.name === 'mobile-390' ? 844 : 667 })
await bottomTab(page, '倒数日').click()
const focus = page.locator('.countdown-focus').filter({ hasText: countdownTitle })