import 'reflect-metadata'; import { TextLogicFunctions, } from './text-logic.functions'; describe('getTextVerticalHeight', () => { // tslint:disable-next-line test('It gets the right vertical height if there is a single line of text', () => { expect( TextLogicFunctions.getTextVerticalHeight( 'abcd', 12, 3, ), ).toBe(36); }); // tslint:disable-next-line test('It gets the right vertical height if there are multiple lines of text', () => { expect( TextLogicFunctions.getTextVerticalHeight( 'abcd\n new line', 12, 3, ), ).toBe(72); }); }); describe('getRelativeTextSize', () => { // tslint: disable-next-line test('It gets the expected size in px', () => { expect( TextLogicFunctions.getRelativeTextSize( '12px', 10, 20, ), ).toBe('6px'); }); // tslint: disable-next-line test('It gets the expected size in pt', () => { expect( TextLogicFunctions.getRelativeTextSize( '12pt', 10, 20, ), ).toBe('6pt'); }); // tslint:disable-next-line test('It gets the expected size even when the rendered width is larger', () => { expect( TextLogicFunctions.getRelativeTextSize( '12pt', 20, 10, ), ).toBe('24pt'); }); });