File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed
Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ const Select = React.forwardRef(({
2525 onClick,
2626 onSelect,
2727 placeholder,
28+ popoverProps,
2829 readOnly,
2930 selectedKey,
3031 validationState,
@@ -135,6 +136,9 @@ const Select = React.forwardRef(({
135136
136137 return (
137138 < Popover
139+ placement = 'bottom-start'
140+ widthSizingType = 'minTarget'
141+ { ...popoverProps }
138142 body = {
139143 ( < >
140144 { validationState &&
@@ -169,11 +173,9 @@ const Select = React.forwardRef(({
169173 disableTriggerOnClick = { disabled || readOnly }
170174 firstFocusIndex = { firstFocusIndex }
171175 noArrow
172- placement = 'bottom-start'
173176 ref = { popoverRef }
174177 type = 'listbox'
175- useArrowKeyNavigation
176- widthSizingType = 'minTarget' />
178+ useArrowKeyNavigation />
177179 ) ;
178180} ) ;
179181
@@ -199,6 +201,8 @@ Select.propTypes = {
199201 } ) ) ,
200202 /** Localized placeholder text of the input */
201203 placeholder : PropTypes . string ,
204+ /** Additional props to be spread to the Popover component */
205+ popoverProps : PropTypes . object ,
202206 /** Set to **true** to enable readonly mode */
203207 readOnly : PropTypes . bool ,
204208 /** The key corresponding to the selected option */
Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ describe('<Select />', () => {
1010 { key : '4' , text : 'List Item 4' }
1111 ] ;
1212
13+ const popoverProps = {
14+ [ 'data-sample' ] : 'Popper-sample'
15+ } ;
16+
1317 describe ( 'Prop spreading' , ( ) => {
1418 test ( 'should allow props to be spread to the Select component' , ( ) => {
1519 const element = mount (
@@ -18,6 +22,16 @@ describe('<Select />', () => {
1822
1923 expect ( element . find ( '.fd-select' ) . getDOMNode ( ) . attributes [ 'data-sample' ] . value ) . toBe ( 'Sample' ) ;
2024 } ) ;
25+
26+ test ( 'should allow props to be spread to the Popover component' , ( ) => {
27+ const element = mount (
28+ < Select options = { options } popoverProps = { popoverProps } />
29+ ) ;
30+
31+ expect (
32+ element . find ( '.fd-popover' ) . at ( 0 ) . getDOMNode ( ) . attributes [ 'data-sample' ] . value
33+ ) . toBe ( 'Popper-sample' ) ;
34+ } ) ;
2135 } ) ;
2236
2337 describe ( 'interactions' , ( ) => {
You can’t perform that action at this time.
0 commit comments