fix(editor): Task 1 review round 1, section back pops, scroll proof

This commit is contained in:
bchanot committed 2026-11-13 18:12:19 +01:00
1 parent 792394d3b2
commit 8e4f02620a
7 files changed
+251 -64

No files matched your search

@@ -128,6 +128,21 @@ describe('the announcer', () => {
})
})
describe('the announcer, a wait that never fires', () => {
it('does not hold later messages back', async () => {
const user = userEvent.setup()
mount()
const dialog = document.createElement('dialog')
dialog.setAttribute('open', '')
document.body.append(dialog)
await user.click(screen.getByRole('button', { name: 'say one' }))
// the dialog goes without ModalDialog's cleanup: nothing flushes the queue
dialog.remove()
await user.click(screen.getByRole('button', { name: 'say two' }))
expect(screen.getByTestId('live')).toHaveTextContent('one. two')
})
})
describe('useBeforeUnload', () => {
it('asks while dirty and stops when clean', () => {
const { rerender } = renderHook(({ dirty }) => useBeforeUnload(dirty), {