Files
faunosteo/apps/app/tests/unit/ui.Dialog.test.tsx
T
bchanot 8673475293 chore(workspace): move the app to apps/app under a pnpm workspace (step 2)
144 files moved with git mv (pure renames). Root package.json delegates
dev/typecheck/test:run/lint/build to the packages; Node 24 LTS and
pnpm 10.13.1 pinned (.nvmrc, .node-version, engines, packageManager,
root devDependency, engine-strict). Dockerfile builds @faunosteo/app on
node:24-alpine and copies apps/app/dist; nginx and runtime config
unchanged. CI workflow for Gitea Actions. packages/ reserved (README only).
Docs synced: WORKSPACE.md, CLAUDE.md, README, DEPLOY, CHANGELOG, plan.
271/271 tests, typecheck, lint, build green from the root.
2026-10-08 21:51:13 +02:00

36 lines
943 B
TypeScript

import { describe, it, expect, vi } from 'vitest'
import { render, screen } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import Dialog from '@/components/ui/Dialog'
describe('Dialog', () => {
it('renders nothing when open=false', () => {
render(
<Dialog open={false} onClose={() => {}} title="X">
body
</Dialog>,
)
expect(screen.queryByText('body')).toBeNull()
})
it('renders content when open=true', () => {
render(
<Dialog open={true} onClose={() => {}} title="X">
body
</Dialog>,
)
expect(screen.getByText('body')).toBeInTheDocument()
})
it('calls onClose on backdrop click', async () => {
const onClose = vi.fn()
render(
<Dialog open onClose={onClose} title="X">
body
</Dialog>,
)
await userEvent.click(screen.getByTestId('dialog-backdrop'))
expect(onClose).toHaveBeenCalled()
})
})