Skip to content

Commit c383302

Browse files
committed
test(ActionList): add mixed descriptions stress test story
1 parent d407207 commit c383302

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

packages/react/src/ActionList/ActionList.stress.dev.stories.tsx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ const projects = Array.from({length: totalIterations}, (_, i) => ({
1616
scope: `Scope ${i + 1}`,
1717
}))
1818

19+
const mixedProjects = Array.from({length: totalIterations}, (_, i) => ({
20+
name: `Project ${i + 1}`,
21+
scope: i % 2 === 0 ? `Scope ${i + 1}` : undefined,
22+
}))
23+
1924
export const SingleSelect = () => {
2025
return (
2126
<StressTest
@@ -48,3 +53,38 @@ export const SingleSelect = () => {
4853
/>
4954
)
5055
}
56+
57+
export const MixedDescriptions = () => {
58+
return (
59+
<StressTest
60+
componentName="ActionList"
61+
title="Mixed Descriptions"
62+
description="Stress test with a mix of items with and without descriptions to test :has() selector perf."
63+
totalIterations={totalIterations}
64+
renderIteration={count => {
65+
return (
66+
<>
67+
<ActionList selectionVariant="single" showDividers role="menu" aria-label="Project">
68+
{mixedProjects.map((project, index) => (
69+
<ActionList.Item
70+
key={index}
71+
role="menuitemradio"
72+
selected={index === count}
73+
aria-checked={index === count}
74+
>
75+
<ActionList.LeadingVisual>
76+
<TableIcon />
77+
</ActionList.LeadingVisual>
78+
{project.name}
79+
{project.scope ? (
80+
<ActionList.Description variant="block">{project.scope}</ActionList.Description>
81+
) : null}
82+
</ActionList.Item>
83+
))}
84+
</ActionList>
85+
</>
86+
)
87+
}}
88+
/>
89+
)
90+
}

0 commit comments

Comments
 (0)