Files
edentext/tests/unit/kerning.test.ts
T
Steffen Becker 361ce14864 feat: pair kerning follows the file, not the browser
A browser always kerns; ODF kerns unless told not to and Word kerns only
above the size w:kern names — nothing, in most files. Measured 5% on a
kerning-heavy string, enough to break a line a word early throughout every
Word document in the corpus. Carried on the style, since that is where
w:docDefaults and the default paragraph style put it.
2026-08-11 07:23:20 +00:00

21 lines
955 B
TypeScript

import { describe, it, expect } from 'vitest';
import { styleCss, builtinStyleSheet } from '../../src/lib/styles/styleSheet';
// ODF kerns by default and Word does not, so only the off state is ever stored.
describe('pair kerning', () => {
it('renders font-kerning only where a style turns it off', () => {
const sheet = builtinStyleSheet();
expect(styleCss(sheet)).not.toContain('font-kerning');
sheet.paragraph.Standard.text = { ...sheet.paragraph.Standard.text, kerning: false };
expect(styleCss(sheet)).toContain('font-kerning: none');
});
it('inherits the off state down the parent chain', () => {
const sheet = builtinStyleSheet();
sheet.paragraph.Standard.text = { ...sheet.paragraph.Standard.text, kerning: false };
const css = styleCss(sheet);
const heading = css.slice(css.indexOf('[data-style="Heading 1"]'));
expect(heading.slice(0, heading.indexOf('}'))).toContain('font-kerning: none');
});
});