import { describe, it, expect, vi } from 'vitest' import { screen, waitFor } from '@testing-library/react' import { render } from '../../../tests/helpers/render' import userEvent from '@testing-library/user-event' import { useRef, useState } from 'react' import NoteFormatToolbar from './NoteFormatToolbar' /** * The toolbar edits somebody else's controlled field, so every test drives it * through a real textarea rather than asserting on a callback in isolation — * the selection handling is the part that breaks, and it only exists in the DOM. */ function Harness({ initial = '', onValue, customTooltips }: { initial?: string; onValue?: (v: string) => void; customTooltips?: boolean }) { const ref = useRef(null) const [value, setValue] = useState(initial) return ( <> { setValue(v); onValue?.(v) }} customTooltips={customTooltips} />