chore: move getPretextFontString into separate directory
This commit is contained in:
+35
@@ -0,0 +1,35 @@
|
||||
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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user