diff --git a/src/components/Select/Select.jsx b/src/components/Select/Select.jsx index 3dac4f1906..f4c31eb64b 100644 --- a/src/components/Select/Select.jsx +++ b/src/components/Select/Select.jsx @@ -14,7 +14,7 @@ import formFieldStyles from '../FormFields.modules.scss' import positionStyles from '../Position.modules.scss' import iconWrapperStyles from '../Icons/IconWrapper.modules.scss' -const Select = ({ options, ...props }) => ( +const Select = ({ options, placeholder, ...props }) => ( {({ className, ...selectProps }, showIcon, feedback) => (
@@ -22,6 +22,11 @@ const Select = ({ options, ...props }) => ( {...selectProps} className={joinClassNames(className, styles.select, formFieldStyles.height)} > + {placeholder && ( + + )} {options.map(({ text, value }) => ( + ) + }) + it('can have an error message', () => { const { select } = doMount({ id: 'some-id', error: 'Oh no a terrible error!' }) @@ -336,10 +346,10 @@ describe('Select', () => { }) it('passes additional attributes to the select element', () => { - const { findSelectElement } = doMount({ name: 'a name', placeholder: 'a placeholder' }) + const { findSelectElement } = doMount({ name: 'a name', id: 'the-id' }) expect(findSelectElement()).toHaveProp('name', 'a name') - expect(findSelectElement()).toHaveProp('placeholder', 'a placeholder') + expect(findSelectElement()).toHaveProp('id', 'the-id') }) it('does not allow custom CSS', () => {