Skip to content

Commit 822e80f

Browse files
committed
test(a11y): assert visible label instead of decorative icon in StatusBadge
The status icon is now aria-hidden (decorative), so querying it requires a brittle .lucide class selector. Drop those icon-presence assertions and rely on the visible badge label, which is the user-meaningful output. Signed-off-by: mschwab <mschwab@nvidia.com>
1 parent 0105ca7 commit 822e80f

1 file changed

Lines changed: 2 additions & 13 deletions

File tree

web/packages/common/src/components/StatusBadge/StatusBadge.test.tsx

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@ describe('StatusBadge component', () => {
8383
expect(badge).toBeInTheDocument();
8484
expect(badge).toHaveTextContent(expectedBadge.label);
8585

86-
// eslint-disable-next-line testing-library/no-node-access
87-
const icon = document.querySelector('.lucide');
88-
expect(icon).toBeInTheDocument();
89-
9086
unmount();
9187
});
9288
});
@@ -156,16 +152,9 @@ describe('StatusBadge component', () => {
156152
expect(screen.getByTestId('nv-badge')).toHaveTextContent('Success');
157153
});
158154

159-
it('renders icon when config entry has one', () => {
160-
render(<StatusBadge status="success" statusConfig={STATUS_CONFIG} />);
161-
// eslint-disable-next-line testing-library/no-node-access
162-
expect(document.querySelector('.lucide-circle-check')).toBeInTheDocument();
163-
});
164-
165-
it('renders no icon when config entry omits one', () => {
155+
it('renders the label for a config entry without an icon', () => {
166156
render(<StatusBadge status="error" statusConfig={STATUS_CONFIG} />);
167-
// eslint-disable-next-line testing-library/no-node-access
168-
expect(document.querySelector('.lucide')).not.toBeInTheDocument();
157+
expect(screen.getByTestId('nv-badge')).toHaveTextContent('Error');
169158
});
170159

171160
it('falls back to provided fallback for unknown status', () => {

0 commit comments

Comments
 (0)