File tree Expand file tree Collapse file tree
app/entities/navigation-tabs/ui/__stories__ Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -107,3 +107,30 @@ export const MobileSelect: Story = {
107107 expect ( args . onSelectChange ) . toHaveBeenCalledWith ( 'programs' ) ;
108108 } ,
109109} ;
110+
111+ export const OverlappingAsyncTabs : Story = {
112+ args : {
113+ activeValue : '' ,
114+ tabs : BLOCK_TABS ,
115+ } ,
116+ render : args => (
117+ < BaseNavigationTabs { ...args } >
118+ { /* "rewards" overlaps with static tab, "extra" is new */ }
119+ < NavigationTabLink path = "rewards" title = "Rewards" />
120+ < NavigationTabLink path = "extra" title = "Extra Tab" />
121+ </ BaseNavigationTabs >
122+ ) ,
123+ play : async ( { canvasElement } ) => {
124+ const canvas = within ( canvasElement ) ;
125+ const tablist = canvas . getByRole ( 'tablist' , { hidden : true } ) ;
126+ const tabs = within ( tablist ) . getAllByRole ( 'tab' , { hidden : true } ) ;
127+
128+ // Desktop tablist: 4 static + 2 children rendered (both appear in DOM)
129+ expect ( tabs ) . toHaveLength ( 6 ) ;
130+
131+ // Mobile select: should deduplicate "rewards", so 4 static + 1 new = 5
132+ const select = canvasElement . querySelector ( 'select' ) as HTMLSelectElement ;
133+ expect ( select . options ) . toHaveLength ( 5 ) ;
134+ expect ( select . options [ 4 ] ) . toHaveTextContent ( 'Extra Tab' ) ;
135+ } ,
136+ } ;
You can’t perform that action at this time.
0 commit comments