feat(notes): wire app with floating add button

This commit is contained in:
devcodetools committed 2026-09-13 15:34:50 +02:00
1 parent 0af0cdc405
commit 9a086cbe7b
5 files changed
+213 -7

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
import { fireEvent, render, screen } from '@testing-library/react'
import { describe, expect, it, vi } from 'vitest'
import FloatingButton from './FloatingButton'
describe('FloatingButton', () => {
it('renders a + button', () => {
render(<FloatingButton onClick={vi.fn()} />)
expect(screen.getByRole('button', { name: 'Créer une note' })).toHaveTextContent('+')
})
it('calls onClick when clicked', () => {
const onClick = vi.fn()
render(<FloatingButton onClick={onClick} />)
fireEvent.click(screen.getByRole('button', { name: 'Créer une note' }))
expect(onClick).toHaveBeenCalled()
})
it('uses a custom label when provided', () => {
render(<FloatingButton onClick={vi.fn()} label="Ajouter" />)
expect(screen.getByRole('button', { name: 'Ajouter' })).toBeInTheDocument()
})
})