Skip to content

Commit

Permalink
Add Whirl component and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mhnpd committed Dec 22, 2023
1 parent ef094f7 commit 615608d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/experimental/whirl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export const Whirl: FunctionComponent<WhirlProps> = ({
viewBox="0 0 100 100"
className={wrapperClass}
preserveAspectRatio="xMidYMid"
data-testid="whirl"
>
<g transform="translate(50,50)">
<g transform="scale(0.8)">
Expand Down
30 changes: 30 additions & 0 deletions test/experimantal/whirl.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import { Whirl } from '../../src/beta'

describe('Whirl', () => {
test('renders Whirl component', () => {
render(<Whirl />);
const svgElement = screen.getByTestId('whirl');
expect(svgElement).toBeInTheDocument();
});

test('applies wrapperClass correctly', () => {
render(<Whirl wrapperClass="test-class" />);
const svgElement = screen.getByTestId('whirl');
expect(svgElement).toHaveClass('test-class');
});

test('applies wrapperStyle correctly', () => {
render(<Whirl wrapperStyle={{ backgroundColor: 'red' }} />);
const svgElement = screen.getByTestId('whirl');
expect(svgElement).toHaveStyle('background-color: red');
});

test('does not render when visible is false', () => {
render(<Whirl visible={false} />);
const svg = screen.queryByTestId('whirl');
expect(svg).not.toBeInTheDocument();
});
});

0 comments on commit 615608d

Please sign in to comment.