Skip to content

Feature/revert close on blur #647

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion src/autocomplete/Autocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,6 @@ export const Autocomplete = ({

const onBlur = () => {
setShowPrompt(false);
setShowOptions(false);
};

const setAccessibilityStatus = (newStatus: string) => {
Expand Down
32 changes: 0 additions & 32 deletions src/autocomplete/__tests__/Autocomplete.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1248,38 +1248,6 @@ describe('Autocomplete', () => {
expect(change.mock.calls[3][2]).toBe(0);
});

it('should close the options list on blur', async () => {
const user = userEvent.setup();
const { container } = render(
<Autocomplete
options={[
'Papaya',
'Persimmon',
'Paw Paw',
'Prickly Pear',
'Peach',
'Pomegranate',
'Pineapple',
]}
id="fruitTest"
labelText="search the list of fruits"
notFoundText="No fruit found"
resultId="fruit-options-container"
optionsId="fruit-option"
/>
);

const inputElm = screen.getByRole('combobox');
await user.type(inputElm, 'p');
expect(screen.getAllByRole('option').length).toBe(7);

act(() => {
fireEvent.blur(inputElm);
});
const options: any = container.querySelector('li');
expect(options).not.toBeInTheDocument();
});

it('should make sure status container is in the correct position', async () => {
const change = jest.fn();
const hint =
Expand Down