36 lines
1015 B
TypeScript
36 lines
1015 B
TypeScript
|
|
import {
|
||
|
|
describe,
|
||
|
|
expect,
|
||
|
|
it,
|
||
|
|
} from 'vitest';
|
||
|
|
import { getPretextFontString } from './getPretextFontString';
|
||
|
|
|
||
|
|
describe('getPretextFontString', () => {
|
||
|
|
it('correctly formats the font string for pretext', () => {
|
||
|
|
const weight = 400;
|
||
|
|
const sizePx = 16;
|
||
|
|
const fontName = 'Inter';
|
||
|
|
const expected = '400 16px "Inter"';
|
||
|
|
|
||
|
|
expect(getPretextFontString(weight, sizePx, fontName)).toBe(expected);
|
||
|
|
});
|
||
|
|
|
||
|
|
it('works with different weight and size', () => {
|
||
|
|
const weight = 700;
|
||
|
|
const sizePx = 32;
|
||
|
|
const fontName = 'Roboto';
|
||
|
|
const expected = '700 32px "Roboto"';
|
||
|
|
|
||
|
|
expect(getPretextFontString(weight, sizePx, fontName)).toBe(expected);
|
||
|
|
});
|
||
|
|
|
||
|
|
it('handles font names with spaces', () => {
|
||
|
|
const weight = 400;
|
||
|
|
const sizePx = 16;
|
||
|
|
const fontName = 'Open Sans';
|
||
|
|
const expected = '400 16px "Open Sans"';
|
||
|
|
|
||
|
|
expect(getPretextFontString(weight, sizePx, fontName)).toBe(expected);
|
||
|
|
});
|
||
|
|
});
|