feat(editor): finding dialog and citations side sheet in the history
Constats opens each element in one modal dialog (view, edit with a local draft, creation) driven by the editor view layer of the browser history. The citations panel becomes a modal side sheet stacked over it; its geometry, exit machinery and page inertness are removed. Back and Forward restore the layers, a dirty form asks first.
This commit is contained in:
1 parent
8e4f02620a
commit
18085cecf8
50 files changed
+2642
-1504
No files matched your search
@@ -15,6 +15,7 @@ import ModalDialog from '@/components/ui/ModalDialog'
|
||||
import { useLocaleStore } from '@/state/localeStore'
|
||||
import { drawnText, edit, insert, point } from '../helpers/editorFixtures'
|
||||
import { resetStore, serverHas, store } from '../helpers/editorHarness'
|
||||
import { openFinding } from '../helpers/findingDialog'
|
||||
import { mountDraft, setWidth } from '../helpers/editorRoute'
|
||||
|
||||
vi.mock('@/lib/supabase', () => ({ getSupabaseClient: () => ({}) }))
|
||||
@@ -142,9 +143,7 @@ const citations = () => screen.queryByTestId('editor-citations-panel')
|
||||
/** Constats, the node selected, its « 1 référence » trigger pressed. */
|
||||
async function openCitations(user: ReturnType<typeof userEvent.setup>) {
|
||||
await user.click(screen.getByRole('tab', { name: 'Constats' }))
|
||||
await user.click(screen.getByRole('treeitem', { name: /Cat A/ }))
|
||||
await user.keyboard('{ArrowRight}')
|
||||
await user.click(screen.getByRole('treeitem', { name: /Node A/ }))
|
||||
await openFinding(user, /Node A/)
|
||||
await user.click(screen.getByRole('button', { name: '1 référence' }))
|
||||
expect(citations()).not.toBeNull()
|
||||
}
|
||||
@@ -277,15 +276,21 @@ describe('Escape with the focus on the page', () => {
|
||||
expect(panel()).toBeDefined()
|
||||
})
|
||||
|
||||
it('the citations panel open: it closes, the annotation selection is kept', async () => {
|
||||
it('the citations sheet open: Escape closes it only, the annotation selection is kept', async () => {
|
||||
const user = await mount(WITH_NODE())
|
||||
await select(user)
|
||||
await openCitations(user)
|
||||
const trigger = screen.getByRole('button', { name: '1 référence' })
|
||||
expect(trigger).toHaveAttribute('aria-expanded', 'true')
|
||||
escape(document.body)
|
||||
await user.keyboard('{Escape}')
|
||||
await waitFor(() => expect(citations()).toBeNull())
|
||||
expect(trigger).toHaveAttribute('aria-expanded', 'false')
|
||||
// the finding dialog under the sheet is still there: a second Escape closes it
|
||||
expect(document.querySelector('dialog[open]')).not.toBeNull()
|
||||
await user.keyboard('{Escape}')
|
||||
await waitFor(() =>
|
||||
expect(document.querySelector('dialog[open]')).toBeNull(),
|
||||
)
|
||||
await user.click(screen.getByRole('tab', { name: 'Annotations' }))
|
||||
expect(panel()).toBeDefined()
|
||||
})
|
||||
@@ -317,16 +322,6 @@ describe('Escape with the focus on the page', () => {
|
||||
})
|
||||
|
||||
describe('Escape and the other layers', () => {
|
||||
it('closes the citations panel from the tab row, the selection kept', async () => {
|
||||
const user = await mount(WITH_NODE())
|
||||
await select(user)
|
||||
await openCitations(user)
|
||||
escape(screen.getByRole('tab', { name: 'Constats' }))
|
||||
await waitFor(() => expect(citations()).toBeNull())
|
||||
await user.click(screen.getByRole('tab', { name: 'Annotations' }))
|
||||
expect(panel()).toBeDefined()
|
||||
})
|
||||
|
||||
it('closes « Plus » first (small tier), the twin selection kept', async () => {
|
||||
const user = await mount(TWO(), 500)
|
||||
await select(user)
|
||||
|
||||
Reference in new issue
Block a user