Skip to content

Commit acd9830

Browse files
authored
Adapt test for proper aria labels on icon buttons
1 parent d27c6d0 commit acd9830

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/react/src/SegmentedControl/SegmentedControl.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ describe('SegmentedControl', () => {
8080
})
8181

8282
it('renders the hideLabels variant', () => {
83-
const {getByLabelText} = render(
83+
const {getByRole} = render(
8484
<SegmentedControl aria-label="File view" variant={{narrow: 'hideLabels'}}>
8585
{segmentData.map(({label, icon}, index) => (
8686
<SegmentedControl.Button leadingVisual={icon} selected={index === 1} key={label}>
@@ -91,8 +91,8 @@ describe('SegmentedControl', () => {
9191
)
9292

9393
for (const datum of segmentData) {
94-
const labelledButton = getByLabelText(datum.label)
95-
expect(labelledButton).toBeDefined()
94+
const labelledButton = getByRole('button', {name: datum.iconLabel})
95+
expect(labelledButton).toBeInTheDocument()
9696
}
9797
})
9898

0 commit comments

Comments
 (0)