feat(editor): dialog close button is a 44 px touch box
This commit is contained in:
1 parent
ae02f48853
commit
240c2ba0e7
4 files changed
+79
-5
No files matched your search
@@ -198,6 +198,31 @@ test('fits the viewport without horizontal page scroll', async ({ page }) => {
|
||||
}
|
||||
})
|
||||
|
||||
// Rev 6: the ✕ is a 44 × 44 px touch box (MobileDrawer's), never squeezed by a long title.
|
||||
test('the close button is a 44 px box beside a long title at 320, 375 and 1280 px', async ({
|
||||
page,
|
||||
}) => {
|
||||
const title =
|
||||
'A dialog title long enough to wrap over several lines on a narrow phone screen'
|
||||
const dialog = await openScenario(page, 'Open wrapped title', title)
|
||||
const close = dialog.getByRole('button', { name: fr['common.close'] })
|
||||
for (const width of [320, 375, 1280]) {
|
||||
await page.setViewportSize({ width, height: 700 })
|
||||
// Polled: the panel scales in (0.96 to 1) right after it opens.
|
||||
const box = async () => (await close.boundingBox())!
|
||||
await expect
|
||||
.poll(async () => (await box()).width, { message: `✕ width at ${width}` })
|
||||
.toBeGreaterThanOrEqual(44)
|
||||
expect((await box()).height, `✕ height at ${width}`).toBeGreaterThanOrEqual(
|
||||
44,
|
||||
)
|
||||
const { x, width: size } = await box()
|
||||
expect(x + size, `✕ inside at ${width}`).toBeLessThanOrEqual(width + 0.5)
|
||||
await expectNoHorizontalOverflow(page, `the long title at ${width}`)
|
||||
}
|
||||
await expectAccessible(page, 'the long-title dialog')
|
||||
})
|
||||
|
||||
for (const [lang, dict] of [
|
||||
['fr', fr],
|
||||
['en', en],
|
||||
|
||||
Reference in new issue
Block a user