import { describe, expect, it, beforeEach } from 'vitest' import { applyEdit } from './popover' beforeEach(() => { document.body.innerHTML = `

Old

` }) describe('applyEdit', () => { it('applies text + color to the live DOM and returns a diff', () => { const el = document.getElementById('t')! const diff = applyEdit(el, { text: 'New', color: 'rgb(255,0,0)' }) expect(el.textContent).toBe('New') expect(el.style.color).toBe('rgb(255, 0, 0)') expect(diff.text).toEqual({ from: 'Old', to: 'New' }) expect(diff.color?.to).toBe('rgb(255,0,0)') }) })