fix(ui): separate wrapped landing call-to-action lines

This commit is contained in:
cesnimda
2026-10-23 04:27:26 +02:00
parent b9e052cd22
commit 0fb108bd67
6 changed files with 935 additions and 25 deletions
@@ -17,12 +17,13 @@ for (const language of ['en', 'nb'] as const) {
await page.reload();
await expect(page.getByRole('heading', { name: translations[language].landingPreviewTitle, exact: true })).toBeVisible();
await page.evaluate(() => document.fonts.ready);
const headings = await page.locator('h2').evaluateAll(nodes => nodes.map(node => {
const headings = await page.locator('h2').or(page.getByText(translations[language].landingReadyTitle, { exact: true })).evaluateAll(nodes => nodes.map(node => {
const range = document.createRange(); range.selectNodeContents(node);
const lines = [...range.getClientRects()].filter(rect => rect.width > 0).map(rect => ({ top: rect.top, bottom: rect.bottom }));
return { text: node.textContent, lineHeight: getComputedStyle(node).lineHeight, lines };
}));
expect(headings.length).toBeGreaterThanOrEqual(4);
expect(headings.length).toBeGreaterThanOrEqual(5);
expect(headings.some(heading => heading.text === translations[language].landingReadyTitle)).toBe(true);
if (width === 320) expect(headings.some(heading => heading.lines.length > 1)).toBe(true);
for (const heading of headings) for (let index = 1; index < heading.lines.length; index++) {
expect.soft(heading.lines[index].top, `${width}/${theme}: ${heading.text}`).toBeGreaterThanOrEqual(heading.lines[index - 1].bottom - 1);