-
Notifications
You must be signed in to change notification settings - Fork 592
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(Breadcrumb): Upgrade tests and docs, convert to TypeScript
- Loading branch information
1 parent
c197dbf
commit 997721c
Showing
10 changed files
with
263 additions
and
258 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,39 @@ | ||
import React from 'react'; | ||
import Enzyme from 'enzyme'; | ||
import Adapter from 'enzyme-adapter-react-16'; | ||
import Breadcrumb from '../index'; | ||
import '../style'; | ||
import { unmount, testReact } from '../../util/__tests__/legacy/a11y/validate'; | ||
|
||
Enzyme.configure({ adapter: new Adapter() }); | ||
import { testReact } from '../../util/__tests__/a11y/validate'; | ||
|
||
/* eslint-disable no-undef, react/jsx-filename-extension */ | ||
describe('Breadcrumb A11y', () => { | ||
let wrapper; | ||
|
||
afterEach(() => { | ||
if (wrapper) { | ||
wrapper.unmount(); | ||
wrapper = null; | ||
} | ||
unmount(); | ||
}); | ||
|
||
it('should not have any violations when empty', async () => { | ||
wrapper = await testReact(<Breadcrumb />); | ||
return wrapper; | ||
await testReact(<Breadcrumb />); | ||
}); | ||
|
||
it('should not have any violations for breadcrumb items', async () => { | ||
wrapper = await testReact( | ||
await testReact( | ||
<Breadcrumb> | ||
<Breadcrumb.Item link="javascript:void(0);">Home</Breadcrumb.Item> | ||
<Breadcrumb.Item> | ||
T-shirts <b>78,999</b> Results | ||
</Breadcrumb.Item> | ||
</Breadcrumb> | ||
); | ||
return wrapper; | ||
}); | ||
|
||
it('should not have any violations for max node limit', async () => { | ||
wrapper = await testReact( | ||
await testReact( | ||
<Breadcrumb maxNode={2}> | ||
<Breadcrumb.Item>1</Breadcrumb.Item> | ||
<Breadcrumb.Item>2</Breadcrumb.Item> | ||
<Breadcrumb.Item>3</Breadcrumb.Item> | ||
</Breadcrumb> | ||
); | ||
return wrapper; | ||
}); | ||
|
||
it('should not have any violations for separator', async () => { | ||
wrapper = await testReact( | ||
await testReact( | ||
<Breadcrumb separator="/"> | ||
<Breadcrumb.Item>1</Breadcrumb.Item> | ||
<Breadcrumb.Item>2</Breadcrumb.Item> | ||
<Breadcrumb.Item>3</Breadcrumb.Item> | ||
</Breadcrumb> | ||
); | ||
return wrapper; | ||
}); | ||
}); |
Oops, something went wrong.