fix(editor): dialog trigger for references, Task 11 review minors

This commit is contained in:
bchanot committed 2026-11-15 16:25:32 +01:00
1 parent da755f9768
commit d9dbcf1609
11 files changed
+47 -59

No files matched your search

+3 -6
View File
@@ -731,17 +731,14 @@ describe('Constats tab', () => {
await user.click(items()[2])
const trigger = () =>
inFindingDialog().getByRole('button', { name: /^1 référence$/ })
expect(trigger()).toHaveAttribute('aria-expanded', 'false')
expect(trigger()).toHaveAttribute('aria-controls', 'editor-citations-panel')
expect(trigger()).toHaveAttribute('aria-haspopup', 'dialog')
expect(trigger()).not.toHaveAttribute('aria-expanded')
await user.click(trigger())
expect(trigger()).toHaveAttribute('aria-expanded', 'true')
const citations = screen
.getByTestId('editor-citations-panel')
.closest('dialog')!
await user.click(within(citations).getByRole('button', { name: 'Fermer' }))
await waitFor(() =>
expect(trigger()).toHaveAttribute('aria-expanded', 'false'),
)
await waitFor(() => expect(trigger()).toHaveFocus())
})
it('a category has no vet flag; read-only hides the editing actions', async () => {
@@ -172,10 +172,11 @@ describe('opening', () => {
expect(screen.queryByRole('button', { name: 'Références' })).toBeNull()
expect(hasPanel()).toBe(false)
await select(user, /Node A/)
expect(trigger()).toHaveAttribute('aria-expanded', 'false')
expect(trigger()).toHaveAttribute('aria-controls', 'editor-citations-panel')
expect(trigger()).toHaveAttribute('aria-haspopup', 'dialog')
expect(trigger()).not.toHaveAttribute('aria-expanded')
expect(trigger()).not.toHaveAttribute('aria-controls')
await user.click(trigger())
expect(trigger()).toHaveAttribute('aria-expanded', 'true')
expect(trigger()).not.toHaveAttribute('aria-expanded')
await focusIs(closeButton)
expect(heading()).toHaveAttribute('id', 'editor-citations-title')
expect(citationsDialog()).toHaveAttribute(
@@ -310,7 +311,6 @@ describe.each(MODES)('closing, %s', (_label, reduced) => {
fireEvent.click(backdrop())
await closed()
await focusIs(() => trigger())
expect(trigger()).toHaveAttribute('aria-expanded', 'false')
})
it('the platform close request closes it with nothing focused (no key reaches the page)', async () => {
@@ -393,15 +393,13 @@ describe.each(MODES)('closing, %s', (_label, reduced) => {
})
describe('the exit', () => {
it('a dialog playing its exit is inert, its trigger reads « expanded » until it is gone', async () => {
it('a dialog playing its exit is inert until it is gone', async () => {
const user = await mount()
await openFromFinding(user)
expect(trigger()).toHaveAttribute('aria-expanded', 'true')
await user.click(closeButton())
expect(hasPanel()).toBe(true)
expect(panel().closest('dialog')).toHaveAttribute('inert')
await closed()
expect(trigger()).toHaveAttribute('aria-expanded', 'false')
})
it('a second close during the exit finds no layer and does nothing', async () => {