Skip to content

Commit 615608d

Browse files
committed
Add Whirl component and tests
1 parent ef094f7 commit 615608d

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

src/experimental/whirl.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export const Whirl: FunctionComponent<WhirlProps> = ({
5454
viewBox="0 0 100 100"
5555
className={wrapperClass}
5656
preserveAspectRatio="xMidYMid"
57+
data-testid="whirl"
5758
>
5859
<g transform="translate(50,50)">
5960
<g transform="scale(0.8)">

test/experimantal/whirl.spec.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import React from 'react';
2+
import { render, screen } from '@testing-library/react';
3+
import { Whirl } from '../../src/beta'
4+
5+
describe('Whirl', () => {
6+
test('renders Whirl component', () => {
7+
render(<Whirl />);
8+
const svgElement = screen.getByTestId('whirl');
9+
expect(svgElement).toBeInTheDocument();
10+
});
11+
12+
test('applies wrapperClass correctly', () => {
13+
render(<Whirl wrapperClass="test-class" />);
14+
const svgElement = screen.getByTestId('whirl');
15+
expect(svgElement).toHaveClass('test-class');
16+
});
17+
18+
test('applies wrapperStyle correctly', () => {
19+
render(<Whirl wrapperStyle={{ backgroundColor: 'red' }} />);
20+
const svgElement = screen.getByTestId('whirl');
21+
expect(svgElement).toHaveStyle('background-color: red');
22+
});
23+
24+
test('does not render when visible is false', () => {
25+
render(<Whirl visible={false} />);
26+
const svg = screen.queryByTestId('whirl');
27+
expect(svg).not.toBeInTheDocument();
28+
});
29+
});
30+

0 commit comments

Comments
 (0)