Skip to content

Commit 89b8cc9

Browse files
committed
fix: add case with overlapping tabs
1 parent ebc88b8 commit 89b8cc9

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

app/entities/navigation-tabs/ui/__stories__/navigation-tabs.stories.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
};

0 commit comments

Comments
 (0)