Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/__tests__/Heading.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ describe('Heading', () => {
}
})

it('respects the "fontStyle" prop', () => {
expect(render(<Heading fontStyle="italic" />)).toHaveStyleRule('font-style', 'italic')
expect(render(<Heading is="i" fontStyle="normal" />)).toHaveStyleRule('font-style', 'normal')
})

xit('renders fontSize with f* classes using inverse scale', () => {
expect(render(<Heading fontSize={0} theme={theme} />)).toEqual(render(<span className="f6" />))
expect(render(<Heading fontSize={1} theme={theme} />)).toEqual(render(<span className="f5" />))
Expand Down
5 changes: 5 additions & 0 deletions src/__tests__/Link.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,9 @@ describe('Link', () => {
it('respects hoverColor prop', () => {
expect(render(<Link hoverColor="blue.4" />)).toMatchSnapshot()
})

it('respects the "fontStyle" prop', () => {
expect(render(<Link fontStyle="italic" />)).toHaveStyleRule('font-style', 'italic')
expect(render(<Link is="i" fontStyle="normal" />)).toHaveStyleRule('font-style', 'normal')
})
})
7 changes: 6 additions & 1 deletion src/__tests__/Text.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('Text', () => {
expect(render(<Text is="b" />).type).toEqual('b')
})

it('renders font-size', () => {
it('renders fontSize', () => {
for (const fontSize of theme.fontSizes) {
expect(render(<Text fontSize={fontSize} />)).toHaveStyleRule('font-size', px(fontSize))
}
Expand Down Expand Up @@ -51,6 +51,11 @@ describe('Text', () => {
expect(render(<Text fontWeight="normal" />)).toHaveStyleRule('font-weight', '400')
})

it('respects the "fontStyle" prop', () => {
expect(render(<Text fontStyle="italic" />)).toHaveStyleRule('font-style', 'italic')
expect(render(<Text is="i" fontStyle="normal" />)).toHaveStyleRule('font-style', 'normal')
})

it('respects lineHeight', () => {
for (const [name, value] of Object.entries(theme.lineHeights)) {
expect(render(<Text lineHeight={name} />)).toHaveStyleRule('line-height', String(value))
Expand Down
2 changes: 2 additions & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const BORDER = compose(
export const TYPOGRAPHY = compose(
styles.fontFamily,
styles.fontSize,
styles.fontStyle,
styles.fontWeight,
styles.lineHeight,
styles.textAlign
Expand Down Expand Up @@ -73,6 +74,7 @@ export const TYPOGRAPHY_LIST = [
// typography props
'fontFamily',
'fontSize',
'fontStyle',
'fontWeight',
'lineHeight',
'textAlign'
Expand Down