From 734136a443c6e7f245162d05e9af49b98e9c95cd Mon Sep 17 00:00:00 2001 From: Jacob Parker Date: Thu, 3 Oct 2019 21:13:40 +0100 Subject: [PATCH] Remove unitless line height --- src/__tests__/font.js | 13 ++++--------- src/transforms/font.js | 7 +------ 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/src/__tests__/font.js b/src/__tests__/font.js index c68d690..916de19 100644 --- a/src/__tests__/font.js +++ b/src/__tests__/font.js @@ -97,15 +97,10 @@ it('omits line height if not specified', () => { }) }) -it('allows line height as multiple', () => { - expect(transformCss([['font', '16px/1.5 "Helvetica"']])).toEqual({ - fontFamily: 'Helvetica', - fontSize: 16, - fontWeight: 'normal', - fontStyle: 'normal', - fontVariant: [], - lineHeight: 24, - }) +it('does not allow line height as multiple', () => { + expect(() => { + transformCss([['font', '16px/1.5 "Helvetica"']]) + }).toThrow() }) it('transforms font without quotes', () => { diff --git a/src/transforms/font.js b/src/transforms/font.js index c03e96e..ae5e5dd 100644 --- a/src/transforms/font.js +++ b/src/transforms/font.js @@ -4,7 +4,6 @@ import { SPACE, LENGTH, UNSUPPORTED_LENGTH_UNIT, - NUMBER, SLASH, } from '../tokenTypes' @@ -46,11 +45,7 @@ export default tokenStream => { const fontSize = tokenStream.expect(LENGTH, UNSUPPORTED_LENGTH_UNIT) if (tokenStream.matches(SLASH)) { - if (tokenStream.matches(NUMBER)) { - lineHeight = fontSize * tokenStream.lastValue - } else { - lineHeight = tokenStream.expect(LENGTH, UNSUPPORTED_LENGTH_UNIT) - } + lineHeight = tokenStream.expect(LENGTH, UNSUPPORTED_LENGTH_UNIT) } tokenStream.expect(SPACE)