Skip to content

Commit 26f4b49

Browse files
authored
Merge pull request #121 from styled-components/remove-unitless-lineheight
Remove unitless line height
2 parents a28e45d + 734136a commit 26f4b49

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

src/__tests__/font.js

+4-9
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,10 @@ it('omits line height if not specified', () => {
9797
})
9898
})
9999

100-
it('allows line height as multiple', () => {
101-
expect(transformCss([['font', '16px/1.5 "Helvetica"']])).toEqual({
102-
fontFamily: 'Helvetica',
103-
fontSize: 16,
104-
fontWeight: 'normal',
105-
fontStyle: 'normal',
106-
fontVariant: [],
107-
lineHeight: 24,
108-
})
100+
it('does not allow line height as multiple', () => {
101+
expect(() => {
102+
transformCss([['font', '16px/1.5 "Helvetica"']])
103+
}).toThrow()
109104
})
110105

111106
it('transforms font without quotes', () => {

src/transforms/font.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
SPACE,
55
LENGTH,
66
UNSUPPORTED_LENGTH_UNIT,
7-
NUMBER,
87
SLASH,
98
} from '../tokenTypes'
109

@@ -46,11 +45,7 @@ export default tokenStream => {
4645
const fontSize = tokenStream.expect(LENGTH, UNSUPPORTED_LENGTH_UNIT)
4746

4847
if (tokenStream.matches(SLASH)) {
49-
if (tokenStream.matches(NUMBER)) {
50-
lineHeight = fontSize * tokenStream.lastValue
51-
} else {
52-
lineHeight = tokenStream.expect(LENGTH, UNSUPPORTED_LENGTH_UNIT)
53-
}
48+
lineHeight = tokenStream.expect(LENGTH, UNSUPPORTED_LENGTH_UNIT)
5449
}
5550

5651
tokenStream.expect(SPACE)

0 commit comments

Comments
 (0)