Skip to content
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

chore(select-input): add test for when autoFocussed is true #993

Merged
merged 2 commits into from
Aug 5, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/components/inputs/select-input/select-input.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,26 @@ describe('in single mode', () => {
});
});
describe('interacting', () => {
describe('when isAutofocussed is `true`', () => {
it('should open the list and all options should be visible', () => {
const { getByLabelText, getByText } = renderInput({
isAutofocussed: true,
});

const input = getByLabelText('Fruit');

fireEvent.blur(input);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this was the trick?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah... 🤦‍♂.


fireEvent.keyDown(input, {
key: 'ArrowDown',
keyCode: 40,
});

expect(getByText('Mango')).toBeInTheDocument();
expect(getByText('Lichi')).toBeInTheDocument();
expect(getByText('Raspberry')).toBeInTheDocument();
});
});
it('should open the list and all options should be visible', () => {
const { getByLabelText, getByText } = renderInput();
const input = getByLabelText('Fruit');
Expand Down