Skip to content

Commit a5d0d43

Browse files
authored
Visually Hidden component fixes (#666)
1 parent 4409f00 commit a5d0d43

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/components/ui/VisuallyHidden/VisuallyHidden.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export type VisuallyHiddenProps = {
99
children: React.ReactNode;
1010
customRootClass?: string;
1111
className?: string;
12+
asChild?: boolean;
1213
props: Record<string, any>[];
1314
}
1415

src/components/ui/VisuallyHidden/tests/VisuallyHidden.test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ describe('VisuallyHidden Component', () => {
1616

1717
test('renders VisuallyHidden component without asChild prop', () => {
1818
render(<VisuallyHidden >Visually Hidden</VisuallyHidden>);
19-
expect(screen.getByText('Visually Hidden')).tagName === 'DIV';
19+
expect(screen.getByText('Visually Hidden').tagName).toBe('DIV');
2020
});
2121

2222
test('renders VisuallyHidden component with asChild prop as span', () => {
2323
render(<VisuallyHidden asChild><span>Visually Hidden</span></VisuallyHidden>);
24-
expect(screen.getByText('Visually Hidden')).tagName === 'SPAN';
24+
expect(screen.getByText('Visually Hidden').tagName).toBe('SPAN');
25+
2526
});
2627
})

0 commit comments

Comments
 (0)