+
+
+`;
+
+exports[`AutocompleteInput should render with a large size bar 1`] = `
+
+
+
+`;
+
+exports[`AutocompleteInput should render with a regular size bar 1`] = `
+
+
+
+`;
+
+exports[`AutocompleteInput should render with a regular size bar when prop is absent 1`] = `
+
+
+
+`;
+
+exports[`AutocompleteInput should render with a small size bar 1`] = `
+
+
+
+`;
diff --git a/react/components/AutocompleteInput/index.test.tsx b/react/components/AutocompleteInput/index.test.tsx
new file mode 100644
index 000000000..21606e580
--- /dev/null
+++ b/react/components/AutocompleteInput/index.test.tsx
@@ -0,0 +1,130 @@
+import React from 'react'
+import { render } from '@testing-library/react'
+
+import AutocompleteInput from './index'
+
+describe('AutocompleteInput', () => {
+ it('should render with a small size bar', () => {
+ const options = {
+ onSelect: () => `''`,
+ loading: false,
+ value: [],
+ size: 'small',
+ }
+
+ const input = {
+ onChange: () => `''`,
+ onSearch: () => `''`,
+ onClear: () => `''`,
+ placeholder: '',
+ value: '',
+ }
+
+ const { asFragment } = render(
+
+ )
+
+ const result = asFragment()
+
+ expect(result).toMatchSnapshot()
+ })
+
+ it('should render with a regular size bar', () => {
+ const options = {
+ onSelect: () => `''`,
+ loading: false,
+ value: [],
+ size: 'regular',
+ }
+
+ const input = {
+ onChange: () => `''`,
+ onSearch: () => `''`,
+ onClear: () => `''`,
+ placeholder: '',
+ value: '',
+ }
+
+ const { asFragment } = render(
+
+ )
+
+ const result = asFragment()
+
+ expect(result).toMatchSnapshot()
+ })
+
+ it('should render with a large size bar', () => {
+ const options = {
+ onSelect: () => `''`,
+ loading: false,
+ value: [],
+ size: 'large',
+ }
+
+ const input = {
+ onChange: () => `''`,
+ onSearch: () => `''`,
+ onClear: () => `''`,
+ placeholder: '',
+ value: '',
+ }
+
+ const { asFragment } = render(
+
+ )
+
+ const result = asFragment()
+
+ expect(result).toMatchSnapshot()
+ })
+
+ it('should render with a regular size bar when prop is absent', () => {
+ const options = {
+ onSelect: () => `''`,
+ loading: false,
+ value: [],
+ }
+
+ const input = {
+ onChange: () => `''`,
+ onSearch: () => `''`,
+ onClear: () => `''`,
+ placeholder: '',
+ value: '',
+ }
+
+ const { asFragment } = render(
+
+ )
+
+ const result = asFragment()
+
+ expect(result).toMatchSnapshot()
+ })
+
+ it('should render a regular version of search bar if size prop isnt small, regular or large', () => {
+ const options = {
+ onSelect: () => `''`,
+ loading: false,
+ value: [],
+ size: 'medium',
+ }
+
+ const input = {
+ onChange: () => `''`,
+ onSearch: () => `''`,
+ onClear: () => `''`,
+ placeholder: '',
+ value: '',
+ }
+
+ const { asFragment } = render(
+
+ )
+
+ const result = asFragment()
+
+ expect(result).toMatchSnapshot()
+ })
+})
diff --git a/react/components/AutocompleteInput/index.tsx b/react/components/AutocompleteInput/index.tsx
index 05e4d5fcf..316eb08f3 100644
--- a/react/components/AutocompleteInput/index.tsx
+++ b/react/components/AutocompleteInput/index.tsx
@@ -71,6 +71,11 @@ const propTypes = {
/** Last Searched options's title */
label: PropTypes.node.isRequired,
}),
+ /**
+ * Selects a size of the input bar, could be set to `small`, `regular` or `large`.
+ * `regular` is the default value.
+ */
+ size: PropTypes.oneOf(['small', 'regular', 'large']),
}).isRequired,
}
@@ -87,6 +92,7 @@ const AutocompleteInput: React.FunctionComponent
{
const [term, setTerm] = useState(value || '')
@@ -210,6 +216,7 @@ const AutocompleteInput: React.FunctionComponent onSearch(term)}
onClear={handleClear}
onChange={handleTermChange}
+ size={size}
/>
{popoverOpened ? (