This repository has been archived by the owner on May 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename folder, trying to get all the specs passing
- Loading branch information
1 parent
5cd9f0d
commit d79e326
Showing
6 changed files
with
119 additions
and
41 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
File renamed without changes.
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,29 @@ | ||
import '../../../global_setup.js'; | ||
|
||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import Button from '../../../../components/action/button.jsx'; | ||
|
||
describe('<Button/>', () => { | ||
it('returns a button tag', () => { | ||
expect(shallow(<Button />).find('button').length).toBe(1); | ||
}); | ||
|
||
it('supplies the correct props to its child', () => { | ||
const props = { | ||
className: 'usa-button', | ||
disabled: false, | ||
clickHandler: () => true, | ||
type: 'button', | ||
label: 'my-button' | ||
}; | ||
const button = shallow(<Button { ...props } />); | ||
const actualProps = button.find('button').props(); | ||
|
||
expect(actualProps.className).toEqual(props.className); | ||
expect(actualProps.disabled).toEqual(props.disabled); | ||
expect(actualProps.onClick).toEqual(props.clickHandler); | ||
expect(actualProps.type).toEqual(props.type); | ||
expect(actualProps['aria-label']).toEqual(props.label); | ||
}); | ||
}); |
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,26 @@ | ||
import '../../../global_setup.js'; | ||
|
||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import Link from '../../../../components/action/link.jsx'; | ||
|
||
describe('<Link />', () => { | ||
it('returns an `a` tag', () => { | ||
expect(shallow(<Link />).find('a').length).toBe(1); | ||
}); | ||
|
||
it('sets a default href', () => { | ||
const link = shallow(<Link />); | ||
expect(link.find('a').prop('href')).toBe('#'); | ||
}); | ||
|
||
it('sets a base class of `action-link`', () => { | ||
expect(shallow(<Link />).find('a').hasClass('action-link')).toBe(true); | ||
}); | ||
|
||
it('renders its children', () => { | ||
const child = 'hi'; | ||
const link = shallow(<Link>{child}</Link>); | ||
expect(link.find('a').prop('children')).toBe(child); | ||
}); | ||
}); |