|
19 | 19 |
|
20 | 20 | import { test, expect, COMPOSER_INPUT } from './fixtures'; |
21 | 21 |
|
| 22 | +async function choiceContentGeometry(card: import('@playwright/test').Locator) { |
| 23 | + return card.evaluate((element) => { |
| 24 | + const content = Array.from(element.children).find((child) => child.tagName !== 'INPUT'); |
| 25 | + if (!(content instanceof HTMLElement)) { |
| 26 | + throw new Error('SelectableCard content is missing'); |
| 27 | + } |
| 28 | + const cardRect = element.getBoundingClientRect(); |
| 29 | + const contentRect = content.getBoundingClientRect(); |
| 30 | + return { |
| 31 | + cardHeight: cardRect.height, |
| 32 | + contentHeight: contentRect.height, |
| 33 | + topGap: contentRect.top - cardRect.top, |
| 34 | + bottomGap: cardRect.bottom - contentRect.bottom, |
| 35 | + }; |
| 36 | + }); |
| 37 | +} |
| 38 | + |
22 | 39 | test('opening settings commits an active titlebar rename', async ({ window: page }) => { |
23 | 40 | const composer = page.locator(COMPOSER_INPUT); |
24 | 41 | await composer.fill('create a session for settings rename'); |
@@ -104,3 +121,23 @@ test('wide settings gutters scroll the whole main pane', async ({ window: page } |
104 | 121 | await expect.poll(() => pane.evaluate((element) => element.scrollTop)).toBeGreaterThan(0); |
105 | 122 | await expect(content).toBeVisible(); |
106 | 123 | }); |
| 124 | + |
| 125 | +test('appearance choice content stays vertically centered in stretched grid rows', async ({ window: page }) => { |
| 126 | + await page.evaluate(async () => { |
| 127 | + await window.maka.settings.update({ personalization: { uiLocale: 'en' } }); |
| 128 | + }); |
| 129 | + await page.reload(); |
| 130 | + await page.waitForSelector(COMPOSER_INPUT); |
| 131 | + await page.setViewportSize({ width: 1650, height: 992 }); |
| 132 | + await page.getByRole('button', { name: 'Settings' }).click(); |
| 133 | + await page.getByRole('button', { name: 'Appearance', exact: true }).click(); |
| 134 | + await expect(page.getByRole('heading', { name: 'App icon' })).toBeVisible(); |
| 135 | + |
| 136 | + for (const name of ['Azure', 'Classic']) { |
| 137 | + const card = page.getByRole('checkbox', { name, exact: true }).locator('..'); |
| 138 | + await expect(card).toBeVisible(); |
| 139 | + const geometry = await choiceContentGeometry(card); |
| 140 | + expect(geometry.cardHeight).toBeGreaterThan(geometry.contentHeight); |
| 141 | + expect(Math.abs(geometry.topGap - geometry.bottomGap)).toBeLessThanOrEqual(1); |
| 142 | + } |
| 143 | +}); |
0 commit comments