-
Notifications
You must be signed in to change notification settings - Fork 594
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(Search): convert to TypeScript, impove docs and tests
- Loading branch information
Showing
13 changed files
with
430 additions
and
473 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,54 +1,32 @@ | ||
import React from 'react'; | ||
import Enzyme from 'enzyme'; | ||
import Adapter from 'enzyme-adapter-react-16'; | ||
import { unmount, testReact } from '../../util/__tests__/legacy/a11y/validate'; | ||
import { testReact } from '../../util/__tests__/a11y/validate'; | ||
import Search from '../Search'; | ||
import '../style'; | ||
|
||
Enzyme.configure({ adapter: new Adapter() }); | ||
|
||
/* eslint-disable no-undef, react/jsx-filename-extension */ | ||
// TODO: fix `label` - <input> should have some form of label | ||
describe('Search A11y', () => { | ||
let wrapper; | ||
|
||
afterEach(() => { | ||
if (wrapper) { | ||
wrapper.unmount(); | ||
wrapper = null; | ||
} | ||
unmount(); | ||
}); | ||
|
||
it('should not have any violations for secondary', async () => { | ||
wrapper = await testReact(<Search type="secondary" />); | ||
return wrapper; | ||
await testReact(<Search type="secondary" />); | ||
}); | ||
|
||
it('should not have any violations for number value', async () => { | ||
wrapper = await testReact(<Search value={123} />); | ||
return wrapper; | ||
await testReact(<Search value={123} />); | ||
}); | ||
|
||
it('should not have any violations for undefined value', async () => { | ||
wrapper = await testReact(<Search value={undefined} />); | ||
return wrapper; | ||
await testReact(<Search value={undefined} />); | ||
}); | ||
|
||
it('should not have any violations for simple shape', async () => { | ||
wrapper = await testReact(<Search shape="simple" />); | ||
return wrapper; | ||
await testReact(<Search shape="simple" />); | ||
}); | ||
|
||
it('should not have any violations for no icon', async () => { | ||
wrapper = await testReact(<Search hasIcon={false} />); | ||
return wrapper; | ||
await testReact(<Search hasIcon={false} />); | ||
}); | ||
|
||
it('should not have any violations for search text', async () => { | ||
const text = 'search'; | ||
const SearchText = <span>{text}</span>; | ||
wrapper = await testReact(<Search searchText={SearchText} />); | ||
return wrapper; | ||
await testReact(<Search searchText={SearchText} />); | ||
}); | ||
}); |
Oops, something went wrong.