fix: align habit section heading width
This commit is contained in:
@@ -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 })
|
||||
|
||||
Reference in New Issue
Block a user