-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
88 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
import safeRest from '../../../safeRest' | ||
|
||
import styles from './Strong.modules.scss' | ||
|
||
const Strong = ({ children, ...rest }) => ( | ||
<strong {...safeRest(rest)} className={styles.strong}> | ||
{children} | ||
</strong> | ||
) | ||
|
||
Strong.propTypes = { | ||
children: PropTypes.string.isRequired | ||
} | ||
export default Strong |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
``` | ||
<Strong>This text is bold</Strong> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@import '../../../scss/settings/typography'; | ||
|
||
.strong { | ||
@include helvetica-neue-medium-65; | ||
} |
36 changes: 36 additions & 0 deletions
36
src/components/Typography/Strong/__tests__/Strong.spec.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React from 'react' | ||
import { shallow } from 'enzyme' | ||
import toJson from 'enzyme-to-json' | ||
|
||
import Strong from '../Strong' | ||
|
||
describe('Strong', () => { | ||
const doShallow = props => ( | ||
shallow(<Strong {...props}>Some content</Strong>) | ||
) | ||
|
||
it('renders', () => { | ||
const strong = doShallow() | ||
|
||
expect(toJson(strong)).toMatchSnapshot() | ||
}) | ||
|
||
it('renders an HTML strong tag', () => { | ||
const strong = doShallow() | ||
|
||
expect(strong).toHaveTagName('strong') | ||
}) | ||
|
||
it('passes additional attributes to the strong element', () => { | ||
const strong = doShallow({ id: 'the-id' }) | ||
|
||
expect(strong).toHaveProp('id', 'the-id') | ||
}) | ||
|
||
it('does not allow custom CSS', () => { | ||
const strong = doShallow({ className: 'my-custom-class', style: { color: 'hotpink' } }) | ||
|
||
expect(strong).not.toHaveProp('className', 'my-custom-class') | ||
expect(strong).not.toHaveProp('style') | ||
}) | ||
}) |
9 changes: 9 additions & 0 deletions
9
src/components/Typography/Strong/__tests__/__snapshots__/Strong.spec.jsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Strong renders 1`] = ` | ||
<strong | ||
className="strong" | ||
> | ||
Some content | ||
</strong> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters