-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Feat #30 - Add toggle component, icon component, improved verified labels action
- Loading branch information
1 parent
e64138e
commit fc5b3fa
Showing
10 changed files
with
181 additions
and
87 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
<<<<<<< HEAD | ||
<<<<<<< HEAD | ||
name: Pull Request Labels | ||
on: | ||
pull_request: | ||
|
@@ -22,28 +20,3 @@ jobs: | |
mode: minimum | ||
count: 1 | ||
labels: 'fix, bug, bugfix, feature, enhancement, chore' | ||
======= | ||
======= | ||
>>>>>>> chore #41 - Add verify labels GitHub action (#42) | ||
name: Verify Labels | ||
|
||
on: | ||
pull_request: | ||
types: [opened, labeled, unlabeled, synchronize] | ||
|
||
jobs: | ||
check_pr_labels: | ||
runs-on: ubuntu-latest | ||
name: Verify that the PR has a valid label | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Verify PR label action | ||
uses: jesusvasquez333/[email protected] | ||
with: | ||
github-token: '${{ secrets.GITHUB_TOKEN }}' | ||
valid-labels: 'fix, bug, bugfix, feature, enhancement, chore' | ||
<<<<<<< HEAD | ||
>>>>>>> chore #41 - Add verify labels GitHub action (#42) | ||
======= | ||
>>>>>>> chore #41 - Add verify labels GitHub action (#42) |
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
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 |
---|---|---|
@@ -1,43 +1,62 @@ | ||
import React from 'react' | ||
import Link, { LinkProps } from '.' | ||
import { mount, ReactWrapper, shallow } from 'enzyme' | ||
import { mount, ReactWrapper } from 'enzyme' | ||
|
||
let wrapper: ReactWrapper | ||
let mockClick: jest.Mock<void> | ||
const mockProps: LinkProps = { | ||
children: 'Test', | ||
href: '/test', | ||
target: '_blank' | ||
} | ||
|
||
beforeEach(() => { | ||
mockClick = jest.fn() | ||
wrapper = mount(<Link {...mockProps} onClick={mockClick} />) | ||
}) | ||
let mockProps: LinkProps | ||
|
||
describe('Link', () => { | ||
it('renders', () => { | ||
const link = wrapper.find(Link) | ||
expect(link).toHaveLength(1) | ||
describe('Link with href', () => { | ||
beforeEach(() => { | ||
mockProps = { | ||
children: 'Test', | ||
href: '/test', | ||
target: '_blank' | ||
} | ||
|
||
wrapper = mount(<Link {...mockProps} />) | ||
}) | ||
|
||
it('calls onClick function when link is clicked', () => { | ||
const link = wrapper.find(Link) | ||
link.simulate('click') | ||
expect(mockClick).toHaveBeenCalledTimes(1) | ||
it('renders', () => { | ||
expect(wrapper).toHaveLength(1) | ||
}) | ||
|
||
it('has the correct href attribute', () => { | ||
const link = wrapper.find(Link) | ||
expect(link.getDOMNode().getAttribute('href')).toBe(mockProps.href) | ||
expect(wrapper.getDOMNode().getAttribute('href')).toBe(mockProps.href) | ||
}) | ||
|
||
it('has the correct target attribute', () => { | ||
const link = wrapper.find(Link) | ||
expect(link.getDOMNode().getAttribute('target')).toBe(mockProps.target) | ||
expect(wrapper.getDOMNode().getAttribute('target')).toBe( | ||
mockProps.target | ||
) | ||
}) | ||
}) | ||
|
||
describe('Link', () => { | ||
beforeEach(() => { | ||
mockClick = jest.fn() | ||
|
||
mockProps = { | ||
children: 'Test', | ||
onClick: mockClick, | ||
target: '_blank' | ||
} | ||
|
||
it('throws an error if both onClick and href props are undefined', () => { | ||
expect(() => shallow(<Link>Test</Link>)).toThrow() | ||
wrapper = mount(<Link {...mockProps} />) | ||
}) | ||
|
||
it('renders', () => { | ||
expect(wrapper).toHaveLength(1) | ||
}) | ||
|
||
it('calls onClick function when link is clicked', () => { | ||
wrapper.simulate('click') | ||
expect(mockClick).toHaveBeenCalledTimes(1) | ||
}) | ||
|
||
it('has the correct target attribute', () => { | ||
expect(wrapper.getDOMNode().getAttribute('target')).toBe( | ||
mockProps.target | ||
) | ||
}) | ||
}) |
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
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import 'normalize.css' | ||
import '../styles/index.css' | ||
import 'styles/index.css' | ||
export { default as Button } from './Button' | ||
export { default as InputField } from './InputField' | ||
export { default as Icon } from './Icon' | ||
export { default as Link } from './Link' | ||
export { default as Tag } from './Tag' | ||
export { default as Toggle } from './Toggle' |