File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,10 +2,12 @@ import { ClockHands } from '@/ClockHands';
22import { Graduations } from '@/Graduations' ;
33import { getTestId } from '@/utilities' ;
44
5+ export const clockFaceId = 'clock-face' ;
6+
57export const ClockFace = ( ) => (
68 < div
79 class = "grid h-screen place-content-center dark:bg-zinc-800"
8- data-testid = { getTestId ( 'clock-face' ) }
10+ data-testid = { getTestId ( clockFaceId ) }
911 >
1012 < svg class = "h-[95vmin]" viewBox = "0 0 200 200" >
1113 < image class = "size-1/6 translate-5/12" href = "logo.svg" />
Original file line number Diff line number Diff line change 11import { describe , expect , test } from 'vitest' ;
22import { render } from 'vitest-browser-solid' ;
33
4- import { ClockFace } from '@/ClockFace' ;
4+ import { ClockFace , clockFaceId } from '@/ClockFace' ;
55
66describe ( '<ClockFace />' , ( ) => {
77 test ( 'renders clock face' , ( ) => {
88 const screen = render ( ( ) => < ClockFace /> ) ;
9- expect ( screen . getByTestId ( 'clock-face' ) ) . toBeInTheDocument ( ) ;
9+ expect ( screen . getByTestId ( clockFaceId ) ) . toBeInTheDocument ( ) ;
1010 } ) ;
1111 test ( 'unmount clock face' , ( ) => {
12- const { unmount } = render ( ( ) => < ClockFace /> ) ;
13- unmount ( ) ;
12+ const screen = render ( ( ) => < ClockFace /> ) ;
13+ screen . unmount ( ) ;
14+ expect ( screen . getByTestId ( clockFaceId ) ) . not . toBeInTheDocument ( ) ;
1415 } ) ;
1516} ) ;
You can’t perform that action at this time.
0 commit comments