-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(Dropdown): remove diacritics on filter #2021
Changes from 5 commits
fcdb416
4cb709a
ca0b1ca
17feb69
3f1284b
15946be
f93870d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -610,6 +610,37 @@ describe('Dropdown', () => { | |
.find('.selected') | ||
.should.contain.text('a2') | ||
}) | ||
it('filter after diacritics', () => { | ||
const opts = [ | ||
{ text: 'FLOREŞTI', value: '1' }, | ||
{ text: 'ŞANŢU FLOREŞTI', value: '2' }, | ||
{ text: 'FLOREŞTI Alba', value: '3' }, | ||
] | ||
|
||
// search for 'floresti' | ||
wrapperMount(<Dropdown options={opts} search selection />) | ||
.simulate('click') | ||
.find('input.search') | ||
.simulate('change', { target: { value: 'floresti' } }) | ||
|
||
wrapper | ||
.find('.selected') | ||
.should.contain.text('FLOREŞTI') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks great. We can end the test here as one assertion is enough to prove the feature. Skipping the additional arrow down behaviors will make this test stronger. This way, the |
||
|
||
// move selection down | ||
domEvent.keyDown(document, { key: 'ArrowDown' }) | ||
|
||
wrapper | ||
.find('.selected') | ||
.should.contain.text('ŞANŢU FLOREŞTI') | ||
|
||
// move selection down | ||
domEvent.keyDown(document, { key: 'ArrowDown' }) | ||
|
||
wrapper | ||
.find('.selected') | ||
.should.contain.text('FLOREŞTI Alba') | ||
}) | ||
it('still works after encountering "no results"', () => { | ||
const opts = [ | ||
{ text: 'a1', value: 'a1' }, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lodash gracefully handles
null
andundefined
values, so you can safely remove the ternary check here. The method will always return a string: