Skip to content

Commit 674a513

Browse files
cdervclaude
andcommitted
test: Add Playwright tests for callout spacing
Test symmetric spacing in simple untitled callouts and verify titled/default callouts use padding compensation correctly. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 9b2f6a8 commit 674a513

2 files changed

Lines changed: 68 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
title: Callout Spacing Test
3+
---
4+
5+
## Simple Untitled {#simple-untitled}
6+
7+
::: {.callout-note appearance="simple"}
8+
Content without title to test spacing symmetry.
9+
:::
10+
11+
## Simple Titled {#simple-titled}
12+
13+
::: {.callout-note appearance="simple"}
14+
## Note Title
15+
Content with title.
16+
:::
17+
18+
## Default Untitled {#default-untitled}
19+
20+
::: {.callout-note appearance="default"}
21+
Content without title in default appearance.
22+
:::
23+
24+
## Default Titled {#default-titled}
25+
26+
::: {.callout-note appearance="default"}
27+
## Note Title
28+
Content with title in default appearance.
29+
:::
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { test, expect } from '@playwright/test';
2+
import { getCSSProperty } from '../src/utils';
3+
4+
test('Simple untitled callout has symmetric spacing', async ({ page }) => {
5+
await page.goto('./html/callouts/callout-spacing.html');
6+
7+
// Simple untitled callout structure:
8+
// .callout-style-simple > .callout-body > .callout-body-container > p
9+
const simpleUntitledSection = page.locator('#simple-untitled');
10+
const lastChild = simpleUntitledSection.locator('.callout-style-simple:not(.callout-titled) .callout-body-container > p:last-child');
11+
12+
// Verify margin-bottom > 0 (compensation for -0.4em body margin is applied)
13+
const marginBottom = await getCSSProperty(lastChild, 'margin-bottom', true) as number;
14+
expect(marginBottom).toBeGreaterThan(0);
15+
});
16+
17+
test('Simple titled callout spacing is handled by padding', async ({ page }) => {
18+
await page.goto('./html/callouts/callout-spacing.html');
19+
20+
// Simple titled callout structure:
21+
// .callout-style-simple.callout-titled > .callout-body-container.callout-body > p
22+
const simpleTitledSection = page.locator('#simple-titled');
23+
const lastChild = simpleTitledSection.locator('.callout-style-simple.callout-titled .callout-body > p:last-child');
24+
25+
const paddingBottom = await getCSSProperty(lastChild, 'padding-bottom', true) as number;
26+
expect(paddingBottom).toBeGreaterThan(0);
27+
});
28+
29+
test('Default callout spacing is handled by padding', async ({ page }) => {
30+
await page.goto('./html/callouts/callout-spacing.html');
31+
32+
// Default callouts always have .callout-titled class (even without explicit title)
33+
// Structure: .callout-style-default.callout-titled > .callout-body > p
34+
const defaultSection = page.locator('#default-untitled');
35+
const lastChild = defaultSection.locator('.callout-style-default .callout-body > p:last-child');
36+
37+
const paddingBottom = await getCSSProperty(lastChild, 'padding-bottom', true) as number;
38+
expect(paddingBottom).toBeGreaterThan(0);
39+
});

0 commit comments

Comments
 (0)