Sheet, ErrorBanner, Skeleton and EmptyState (#36)
CI / ci (push) Successful in 1m30s

Co-authored-by: dev_agent <dev_agent@cubecraftlabs.com>
Co-committed-by: dev_agent <dev_agent@cubecraftlabs.com>
This commit was merged in pull request #36.
This commit is contained in:
2026-10-03 18:22:59 -04:00
committed by approver_agent
parent 02f1dd6491
commit 732aa92a8c
14 changed files with 729 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
import { fireEvent, render, screen } from '@testing-library/react'
import { describe, expect, it, vi } from 'vitest'
import { expectMinHitArea } from '../test/hitArea.ts'
import { EmptyState } from './EmptyState.tsx'
describe('EmptyState', () => {
it('shows a Bagel title and body without an action by default', () => {
render(<EmptyState title="Quest log is empty">Swipe Try it on a Side quest to save it here.</EmptyState>)
const title = screen.getByRole('heading', { name: 'Quest log is empty' })
expect(getComputedStyle(title).fontFamily).toBe('var(--font-heading)')
expect(screen.getByText('Swipe Try it on a Side quest to save it here.')).toBeInTheDocument()
expect(screen.queryByRole('button')).not.toBeInTheDocument()
})
it('renders the optional primary action and calls its handler', () => {
const onClick = vi.fn()
render(
<EmptyState title="No Regulars yet" action={{ label: 'Add a dinner', onClick }}>
Add the dinners you make most.
</EmptyState>,
)
const action = screen.getByRole('button', { name: 'Add a dinner' })
expectMinHitArea(action)
fireEvent.click(action)
expect(onClick).toHaveBeenCalledTimes(1)
})
})