Skip to content

Commit

Permalink
chore: Remove the debug flag (#358)
Browse files Browse the repository at this point in the history
  • Loading branch information
jessieweiyi authored Sep 16, 2021
1 parent 34661af commit 801d4d8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
4 changes: 1 addition & 3 deletions src/components/Autosuggest/Autosuggest.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,9 @@ React.useEffect(() => {
<Autosuggest
controlId="formFieldId1"
loadingText="Loading services"
onFocus={() => {
onFocus={(e) => {
setOptions([]);
setLoadingStatus(true);
action('onFocus');
}}
statusType={status}
options={options}
Expand Down Expand Up @@ -166,7 +165,6 @@ import { awsServices } from './data/data';
icon={Computer}
filteringType="manual"
freeSolo={true}
disableClearable={true}
options={awsServices}
controlId="formFieldId1"
ariaDescribedby="This is a description"
Expand Down
8 changes: 5 additions & 3 deletions src/components/Autosuggest/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export const Default = () => (
controlId="formFieldId1"
ariaDescribedby="This is a description"
onChange={action('onChange')}
onFocus={action('onFocus')}
onBlur={action('onBlur')}
/>
</FormField>
);
Expand Down Expand Up @@ -105,11 +107,12 @@ export const AsyncLoading = () => {
<Autosuggest
controlId="formFieldId1"
loadingText="Loading services"
onFocus={() => {
onFocus={(e) => {
setOptions([]);
setLoadingStatus(true);
action('onFocus');
action('onFocus')(e);
}}
onBlur={action('onBlur')}
statusType={status}
options={options}
empty="No matching service found"
Expand Down Expand Up @@ -259,7 +262,6 @@ export const WithFreeSolo = () => (
icon={Computer}
freeSolo={true}
filteringType="manual"
disableClearable={true}
options={awsServices}
controlId="formFieldId1"
ariaDescribedby="This is a description"
Expand Down
5 changes: 3 additions & 2 deletions src/components/Autosuggest/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ describe('Autosuggest', () => {
const input = getByPlaceholderText('input-1');

expect(mockEvent).toHaveBeenCalledTimes(0);
fireEvent.change(input, { target: { value: 'Amazon Pay' } });
fireEvent.click(input);
expect(mockEvent).toHaveBeenCalledTimes(1);
});

Expand All @@ -208,8 +208,9 @@ describe('Autosuggest', () => {
const input = getByPlaceholderText('input-1');

expect(mockEvent).toHaveBeenCalledTimes(0);
fireEvent.click(input);
fireEvent.change(input, { target: { value: 'Amazon Pay' } });
fireEvent.keyDown(input, { key: 'Escape', code: '27' });
fireEvent.blur(input);
expect(mockEvent).toHaveBeenCalledTimes(1);
});

Expand Down
8 changes: 3 additions & 5 deletions src/components/Autosuggest/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ const AutosuggestBase: FunctionComponent<AutosuggestBaseProps> = ({
return (
<Stack>
<MaterialUIAutocomplete
debug
multiple={props.multiple}
data-testid={props.multiple ? 'multiselect' : 'autosuggest'}
disabled={disabled}
Expand All @@ -389,13 +388,12 @@ const AutosuggestBase: FunctionComponent<AutosuggestBaseProps> = ({
onChange={handleOnChange}
onInputChange={handleOnInput}
onFocus={onFocus}
onOpen={(e) => {
onBlur={onBlur}
onOpen={() => {
setOpen(true);
onFocus?.(e as React.FocusEvent<HTMLElement>);
}}
onClose={(e) => {
onClose={() => {
setOpen(false);
onBlur?.(e as React.FocusEvent<HTMLElement>);
}}
loading={statusType !== 'finished'}
renderOption={renderOption}
Expand Down

0 comments on commit 801d4d8

Please sign in to comment.