Skip to content

Commit e84f630

Browse files
committed
test(e2e): allow Firefox's input line height for the code language label
The label is a text input, whose line height Firefox floors at the font's `normal` (about 18px with a 20px body), so the test pins the font size and only requires the line height the other browsers give.
1 parent 4fd6777 commit e84f630

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎e2e/theme.spec.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,11 @@ const size = (page: Page, selector: string) =>
292292
test('a font token of inherit keeps the sizes of the code language label and raw blocks', async ({ page }) => {
293293
await page.goto(`/?md=${encodeURIComponent('```js\nlet a = 1;\n```\n\n> quote\n> > nested')}`);
294294
await page.evaluate(() => (window as any).editor.setOptions({ theme: { tokens: { font: 'inherit', mono: 'inherit', fontSize: 20 } } }));
295-
// Scaled from the 20px body, with the 4px of leading its default 24px lines leave.
296-
expect(await size(page, '#editor .mbe-code-lang')).toEqual(['15px', '17px']);
295+
// Scaled from the 20px body, with the 4px of leading its default 24px lines leave. The label is a
296+
// text input, whose line height Firefox floors at the font's `normal` (about 18px here).
297+
const [langSize, langLineHeight] = await size(page, '#editor .mbe-code-lang');
298+
expect(langSize).toBe('15px');
299+
expect(parseFloat(langLineHeight)).toBeGreaterThanOrEqual(17);
297300
// A raw block shows its source when clicked.
298301
await page.locator('#editor > .mbe-raw').click();
299302
expect(await size(page, '#editor pre.mbe-raw')).toEqual(['17.5px', '21.5px']);

0 commit comments

Comments
 (0)