fix: harden mobile pull quote layout
This commit is contained in:
@@ -142,6 +142,49 @@ test("mobile pull quote scales proportionally through 767px", async ({
|
||||
expectNear(text.y + text.height / 2, quote.y + (quote.height - 16) / 2, 8);
|
||||
});
|
||||
|
||||
test("mobile pull quote keeps text above the band at 320px", async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.setViewportSize({ width: 320, height: 800 });
|
||||
await page.goto(homepage);
|
||||
|
||||
const quote = await getBox(page.locator(".pull-quote"));
|
||||
const content = await getBox(page.locator(".pull-quote__content"));
|
||||
const text = await getBox(page.locator(".pull-quote__text"));
|
||||
|
||||
expectNear(quote.height, 320 * 0.898, 6);
|
||||
expectNear(content.height, quote.height - 16, 3);
|
||||
expect(text.y - content.y).toBeGreaterThanOrEqual(12);
|
||||
expect(
|
||||
content.y + content.height - (text.y + text.height),
|
||||
).toBeGreaterThanOrEqual(12);
|
||||
});
|
||||
|
||||
test("mobile pull quote grows when its text needs more room", async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.goto(homepage);
|
||||
|
||||
const quoteLocator = page.locator(".pull-quote");
|
||||
const initialQuote = await getBox(quoteLocator);
|
||||
await page.locator(".pull-quote__text p").evaluate((paragraph) => {
|
||||
paragraph.textContent = `${paragraph.textContent} ${paragraph.textContent} ${paragraph.textContent}`;
|
||||
});
|
||||
|
||||
const quote = await getBox(quoteLocator);
|
||||
const content = await getBox(page.locator(".pull-quote__content"));
|
||||
const text = await getBox(page.locator(".pull-quote__text"));
|
||||
const vector = await getBox(page.locator(".pull-quote__vector--mobile"));
|
||||
|
||||
expect(quote.height).toBeGreaterThan(initialQuote.height);
|
||||
expectNear(content.height, quote.height - 16, 3);
|
||||
expectNear(vector.height, quote.height - 16, 3);
|
||||
expect(text.y).toBeGreaterThanOrEqual(content.y);
|
||||
expect(text.y + text.height).toBeLessThanOrEqual(
|
||||
content.y + content.height,
|
||||
);
|
||||
});
|
||||
|
||||
test("pull quote restores the configured artwork at 768px", async ({
|
||||
page,
|
||||
}) => {
|
||||
@@ -181,6 +224,19 @@ test("mobile pull quote matches the supplied visual reference", async ({
|
||||
);
|
||||
});
|
||||
|
||||
test("mobile pull quote linework render remains stable", async ({ page }) => {
|
||||
await page.goto(homepage);
|
||||
|
||||
await expect(page.locator(".pull-quote__vector--mobile")).toHaveScreenshot(
|
||||
"pullquote-linework-render.png",
|
||||
{
|
||||
animations: "disabled",
|
||||
maxDiffPixelRatio: 0.001,
|
||||
threshold: 0.02,
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
test("mobile recent posts exposes previous and next controls", async ({
|
||||
page,
|
||||
}) => {
|
||||
|
||||
Reference in New Issue
Block a user