File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
packages/mui-material/src/Autocomplete Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,23 @@ describe('<Autocomplete />', () => {
145145 fireEvent . keyDown ( screen . getByRole ( 'combobox' ) , { key : 'ArrowDown' } ) ;
146146 expect ( document . querySelector ( `.${ classes . paper } ` ) . textContent ) . to . equal ( 'Loading…' ) ;
147147 } ) ;
148+
149+ it ( 'should show supplied options to the "options" prop even when loading' , ( ) => {
150+ render (
151+ < Autocomplete
152+ options = { [ 'one' , 'two' ] }
153+ loading
154+ renderInput = { ( params ) => < TextField { ...params } autoFocus /> }
155+ /> ,
156+ ) ;
157+
158+ fireEvent . keyDown ( screen . getByRole ( 'combobox' ) , { key : 'ArrowDown' } ) ;
159+ expect ( document . querySelector ( `.${ classes . paper } ` ) . textContent ) . not . to . equal ( 'Loading…' ) ;
160+
161+ const listbox = screen . getByRole ( 'listbox' ) ;
162+ const htmlOptions = listbox . querySelectorAll ( 'li' ) ;
163+ expect ( htmlOptions [ 0 ] . innerHTML ) . to . equal ( 'one' ) ;
164+ } ) ;
148165 } ) ;
149166
150167 describe ( 'prop: autoHighlight' , ( ) => {
You can’t perform that action at this time.
0 commit comments