Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/ClockFace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import { ClockHands } from '@/ClockHands';
import { Graduations } from '@/Graduations';
import { getTestId } from '@/utilities';

export const clockFaceId = 'clock-face';

export const ClockFace = () => (
<div
class="grid h-screen place-content-center dark:bg-zinc-800"
data-testid={getTestId('clock-face')}
data-testid={getTestId(clockFaceId)}
>
<svg class="h-[95vmin]" viewBox="0 0 200 200">
<image class="size-1/6 translate-5/12" href="logo.svg" />
Expand Down
9 changes: 5 additions & 4 deletions test/ClockFace.test.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import { describe, expect, test } from 'vitest';
import { render } from 'vitest-browser-solid';

import { ClockFace } from '@/ClockFace';
import { ClockFace, clockFaceId } from '@/ClockFace';

describe('<ClockFace />', () => {
test('renders clock face', () => {
const screen = render(() => <ClockFace />);
expect(screen.getByTestId('clock-face')).toBeInTheDocument();
expect(screen.getByTestId(clockFaceId)).toBeInTheDocument();
});
test('unmount clock face', () => {
const { unmount } = render(() => <ClockFace />);
unmount();
const screen = render(() => <ClockFace />);
screen.unmount();
expect(screen.getByTestId(clockFaceId)).not.toBeInTheDocument();
});
});