File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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)" >
Original file line number Diff line number Diff line change 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+
You can’t perform that action at this time.
0 commit comments