@@ -434,21 +434,30 @@ describe('Listbox', () => {
434434 ] ,
435435 } ) ;
436436
437- let orderedItems = listboxInstance . _collection . orderedItems ( ) ;
438- expect ( orderedItems . length ) . toBe ( 3 ) ;
439- expect ( orderedItems [ 0 ] . element . textContent ?. trim ( ) ) . toBe ( 'Item 1' ) ;
440- expect ( orderedItems [ 2 ] . element . textContent ?. trim ( ) ) . toBe ( 'Item 3' ) ;
437+ // Verify initial DOM order
438+ expect ( optionElements . length ) . toBe ( 3 ) ;
439+ expect ( optionElements [ 0 ] . textContent ?. trim ( ) ) . toBe ( 'Item 1' ) ;
440+ expect ( optionElements [ 2 ] . textContent ?. trim ( ) ) . toBe ( 'Item 3' ) ;
441441
442442 const testComponent = fixture . componentInstance as ListboxExample ;
443443 const items = testComponent . options ( ) . reverse ( ) ;
444444 testComponent . options . set ( [ ...items ] ) ;
445445 fixture . detectChanges ( ) ;
446446 await waitForMicrotasks ( ) ;
447447
448- orderedItems = listboxInstance . _collection . orderedItems ( ) ;
449- expect ( orderedItems . length ) . toBe ( 3 ) ;
450- expect ( orderedItems [ 0 ] . element . textContent ?. trim ( ) ) . toBe ( 'Item 3' ) ;
451- expect ( orderedItems [ 2 ] . element . textContent ?. trim ( ) ) . toBe ( 'Item 1' ) ;
448+ // Re-query elements to check new DOM order
449+ defineTestVariables ( fixture ) ;
450+
451+ expect ( optionElements . length ) . toBe ( 3 ) ;
452+ expect ( optionElements [ 0 ] . textContent ?. trim ( ) ) . toBe ( 'Item 3' ) ;
453+ expect ( optionElements [ 2 ] . textContent ?. trim ( ) ) . toBe ( 'Item 1' ) ;
454+ } ) ;
455+ } ) ;
456+
457+ describe ( 'Inert attribute' , ( ) => {
458+ it ( 'should set inert attribute on hard-disabled options' , ( ) => {
459+ setupListbox ( { disabledOptions : [ 0 ] , softDisabled : false } ) ;
460+ expect ( optionElements [ 0 ] . hasAttribute ( 'inert' ) ) . toBe ( true ) ;
452461 } ) ;
453462 } ) ;
454463
0 commit comments