test(web): fix Japanese settings overflow probe

This commit is contained in:
07akioni committed 2026-10-21 17:44:32 +08:00
1 parent bec62b10f6
commit b8c907dbd1
1 file changed
+5 -2
+5 -2
View File
@@ -103,14 +103,17 @@ describe.skipIf(MODE === 'record')('web e2e: native and Client locale preference
await jaDialog.getByRole('button', { name: '日本語', exact: true }).waitFor()
await expect.poll(() => reported).toEqual(['ja'])
expect(await page.evaluate(() => document.documentElement.lang)).toBe('ja')
await page.setViewportSize({ width: 390, height: 844 })
const overflows = (): Promise<number> => jaDialog.evaluate((dialog) => {
const containers = [dialog, ...dialog.querySelectorAll<HTMLElement>('*')]
// The narrow navigation strip scrolls horizontally by design; inspect the panel and section content.
const options = dialog.lastElementChild!
const containers = [dialog, options, ...options.querySelectorAll<HTMLElement>('*')]
.filter(element => element === dialog || ['auto', 'scroll'].includes(getComputedStyle(element).overflowX))
return containers.filter(element => element.clientWidth > 0 && element.scrollWidth > element.clientWidth + 1).length
})
await expect.poll(overflows).toBe(0)
await jaDialog.evaluate((dialog) => {
const options = dialog.querySelector('nav')!.nextElementSibling!.lastElementChild!
const options = dialog.lastElementChild!
const probe = document.createElement('div')
probe.dataset.localeOverflowProbe = ''
probe.style.width = '2000px'