-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(a11y): add a11y testing (based on axe-core)
- Loading branch information
1 parent
32e00d6
commit 15dfee9
Showing
27 changed files
with
325 additions
and
55 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
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
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 |
---|---|---|
|
@@ -63,6 +63,7 @@ exports[`GithubCard should render correctly (snapshot) 1`] = ` | |
style={Object {}} | ||
> | ||
<img | ||
alt="sabertazimi" | ||
onError={[Function]} | ||
src="https://avatars.githubusercontent.com/u/12670482?v=4" | ||
/> | ||
|
@@ -588,6 +589,30 @@ exports[`GithubCard should render correctly (snapshot) 1`] = ` | |
</div> | ||
`; | ||
|
||
exports[`GithubCard should render correctly when missing GitHub data (snapshot) 1`] = ` | ||
<div | ||
className="mx-auto my-0 text-center" | ||
> | ||
<h1 | ||
className="ant-typography" | ||
onClick={null} | ||
style={ | ||
Object { | ||
"WebkitLineClamp": undefined, | ||
} | ||
} | ||
> | ||
Please mail to | ||
<a | ||
href="mailto:[email protected]" | ||
> | ||
me | ||
</a> | ||
. | ||
</h1> | ||
</div> | ||
`; | ||
|
||
exports[`GithubCard should render correctly when missing bio and location data (snapshot) 1`] = ` | ||
<div | ||
className="ant-ribbon-wrapper" | ||
|
@@ -651,6 +676,7 @@ exports[`GithubCard should render correctly when missing bio and location data ( | |
style={Object {}} | ||
> | ||
<img | ||
alt="sabertazimi" | ||
onError={[Function]} | ||
src="https://avatars.githubusercontent.com/u/12670482?v=4" | ||
/> | ||
|
@@ -1175,27 +1201,3 @@ exports[`GithubCard should render correctly when missing bio and location data ( | |
</div> | ||
</div> | ||
`; | ||
|
||
exports[`GithubCard should render correctly when missing github data (snapshot) 1`] = ` | ||
<div | ||
className="mx-auto my-0 text-center" | ||
> | ||
<h1 | ||
className="ant-typography" | ||
onClick={null} | ||
style={ | ||
Object { | ||
"WebkitLineClamp": undefined, | ||
} | ||
} | ||
> | ||
Please mail to | ||
<a | ||
href="mailto:[email protected]" | ||
> | ||
me | ||
</a> | ||
. | ||
</h1> | ||
</div> | ||
`; |
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,25 +1,28 @@ | ||
import { render } from '@testing-library/react'; | ||
import { axe } from 'jest-axe'; | ||
import React from 'react'; | ||
import { create } from 'react-test-renderer'; | ||
import Close from './Close'; | ||
import Comment from './Comment'; | ||
import Hamburger from './Hamburger'; | ||
|
||
describe('Icons', () => { | ||
test('should render [Close] icon correctly (snapshot)', () => { | ||
const tree = create(<Close />).toJSON(); | ||
const Icons = [Close, Comment, Hamburger]; | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
test('should render [Comment] icon correctly (snapshot)', () => { | ||
const tree = create(<Comment />).toJSON(); | ||
test.each(Icons)('should render %# icon correctly (snapshot)', Icon => { | ||
const tree = create(<Icon />).toJSON(); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
test('should render [Hamburger] icon correctly (snapshot)', () => { | ||
const tree = create(<Hamburger />).toJSON(); | ||
test.each(Icons)( | ||
'should render %# icon accessibility guidelines (AXE)', | ||
async Icon => { | ||
const { container } = render(<Icon />); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); | ||
const a11y = await axe(container); | ||
|
||
expect(a11y).toHaveNoViolations(); | ||
} | ||
); | ||
}); |
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
Oops, something went wrong.