@@ -152,7 +152,28 @@ export function runHarnessTests(
152152 const options = await select . getOptions ( ) ;
153153
154154 expect ( groups . length ) . toBe ( 3 ) ;
155- expect ( options . length ) . toBe ( 11 ) ;
155+ expect ( options . length ) . toBe ( 14 ) ;
156+ } ) ;
157+
158+ it ( 'should be able to get the select options when there are multiple open selects' , async ( ) => {
159+ const singleSelect = await loader . getHarness ( selectHarness . with ( {
160+ selector : '#single-selection'
161+ } ) ) ;
162+ await singleSelect . open ( ) ;
163+
164+ const groupedSelect = await loader . getHarness ( selectHarness . with ( { selector : '#grouped' } ) ) ;
165+ await groupedSelect . open ( ) ;
166+
167+ const [ singleOptions , groupedOptions ] = await Promise . all ( [
168+ singleSelect . getOptions ( ) ,
169+ groupedSelect . getOptions ( )
170+ ] ) ;
171+
172+ expect ( await singleOptions [ 0 ] . getText ( ) ) . toBe ( 'Alabama' ) ;
173+ expect ( singleOptions . length ) . toBe ( 11 ) ;
174+
175+ expect ( await groupedOptions [ 0 ] . getText ( ) ) . toBe ( 'Iowa' ) ;
176+ expect ( groupedOptions . length ) . toBe ( 14 ) ;
156177 } ) ;
157178
158179 it ( 'should be able to get the value text from a single-selection select' , async ( ) => {
@@ -268,15 +289,32 @@ class SelectHarnessTest {
268289 stateGroups = [
269290 {
270291 name : 'One' ,
271- states : this . states . slice ( 0 , 3 )
292+ states : [
293+ { code : 'IA' , name : 'Iowa' } ,
294+ { code : 'KS' , name : 'Kansas' } ,
295+ { code : 'KY' , name : 'Kentucky' } ,
296+ { code : 'LA' , name : 'Louisiana' } ,
297+ { code : 'ME' , name : 'Maine' }
298+ ]
272299 } ,
273300 {
274301 name : 'Two' ,
275- states : this . states . slice ( 3 , 7 )
302+ states : [
303+ { code : 'RI' , name : 'Rhode Island' } ,
304+ { code : 'SC' , name : 'South Carolina' } ,
305+ { code : 'SD' , name : 'South Dakota' } ,
306+ { code : 'TN' , name : 'Tennessee' } ,
307+ { code : 'TX' , name : 'Texas' } ,
308+ ]
276309 } ,
277310 {
278311 name : 'Three' ,
279- states : this . states . slice ( 7 )
312+ states : [
313+ { code : 'UT' , name : 'Utah' } ,
314+ { code : 'WA' , name : 'Washington' } ,
315+ { code : 'WV' , name : 'West Virginia' } ,
316+ { code : 'WI' , name : 'Wisconsin' }
317+ ]
280318 }
281319 ] ;
282320}
0 commit comments