|
| 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