Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion packages/layout-engine/painters/dom/src/styles.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { ensureSdtContainerStyles, ensureTrackChangeStyles, lineStyles } from './styles.js';
import { ensureSdtContainerStyles, ensureTrackChangeStyles, lineStyles, pageStyles } from './styles.js';

describe('lineStyles', () => {
it('sets height and lineHeight from the argument', () => {
Expand All @@ -14,6 +14,20 @@ describe('lineStyles', () => {
});
});

describe('pageStyles', () => {
it('sets a black default text color for document content inheritance', () => {
const styles = pageStyles(400, 500);

expect(styles.color).toBe('var(--sd-layout-page-color, #000)');
});

it('allows consumers to override the page text color token', () => {
const styles = pageStyles(400, 500, { color: '#333333' });

expect(styles.color).toBe('#333333');
});
});

describe('ensureSdtContainerStyles', () => {
it('exposes hover border tokens for structured content overrides', () => {
ensureSdtContainerStyles(document);
Expand Down
3 changes: 3 additions & 0 deletions packages/layout-engine/painters/dom/src/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ export type PageStyles = {
background?: string;
boxShadow?: string;
border?: string;
color?: string;
margin?: string;
};

export const DEFAULT_PAGE_STYLES: Required<PageStyles> = {
background: 'var(--sd-layout-page-bg, #fff)',
boxShadow: 'var(--sd-layout-page-shadow, 0 4px 20px rgba(15, 23, 42, 0.08))',
border: '1px solid rgba(15, 23, 42, 0.08)',
color: 'var(--sd-layout-page-color, #000)',
margin: '0 auto',
};

Expand Down Expand Up @@ -77,6 +79,7 @@ export const pageStyles = (width: number, height: number, overrides?: PageStyles
background: merged.background,
boxShadow: merged.boxShadow,
border: merged.border,
color: merged.color,
margin: merged.margin,
overflow: 'hidden',
};
Expand Down
Loading