feat(app): sheet draft editor route, modes, recovery offer and conflict dialog
This commit is contained in:
1 parent
b14509f221
commit
6aba9711f0
44 files changed
+3143
-13
No files matched your search
@@ -159,6 +159,7 @@ function mount(
|
||||
<Route path="sheets" element={<AdminSheetsRoute />} />
|
||||
<Route path="sheets/new" element={<AdminSheetCreateRoute />} />
|
||||
<Route path="sheets/:sheetId" element={<AdminSheetRoute />} />
|
||||
<Route path="sheets/:sheetId/draft" element={<p>draft page</p>} />
|
||||
<Route path="species" element={<AdminSpeciesRoute />} />
|
||||
<Route path="access" element={<AdminAccessRoute />} />
|
||||
</Route>
|
||||
@@ -782,7 +783,7 @@ describe('Sheet creation (A1)', () => {
|
||||
|
||||
await waitFor(() =>
|
||||
expect(screen.getByTestId('where')).toHaveTextContent(
|
||||
`/app/admin/sheets/${NEW_ID}`,
|
||||
`/app/admin/sheets/${NEW_ID}/draft`,
|
||||
),
|
||||
)
|
||||
const [args] = rpcArgs('create_official_sheet')
|
||||
@@ -916,6 +917,26 @@ describe('Sheet overview (H3)', () => {
|
||||
).toBeNull()
|
||||
})
|
||||
|
||||
it('links to the draft: « Ouvrir » for an editor with the admin role, « Consulter » otherwise', async () => {
|
||||
fake.rpcResults.get_official_sheet_admin = { data: overview() }
|
||||
mount(`/app/admin/sheets/${SHEET}`, [grant('sheet_editor')], ['admin'])
|
||||
const open = await screen.findByRole('link', { name: 'Ouvrir le brouillon' })
|
||||
expect(open).toHaveAttribute('href', `/app/admin/sheets/${SHEET}/draft`)
|
||||
cleanup()
|
||||
mount(`/app/admin/sheets/${SHEET}`, [grant('sheet_reviewer')])
|
||||
const view = await screen.findByRole('link', { name: 'Consulter le brouillon' })
|
||||
expect(view).toHaveAttribute('href', `/app/admin/sheets/${SHEET}/draft`)
|
||||
})
|
||||
|
||||
it('links nothing without a draft', async () => {
|
||||
fake.rpcResults.get_official_sheet_admin = {
|
||||
data: overview({ draft_version: null }),
|
||||
}
|
||||
mount(`/app/admin/sheets/${SHEET}`, [grant('sheet_editor')], ['admin'])
|
||||
await screen.findByRole('heading', { level: 1 })
|
||||
expect(screen.queryByRole('link', { name: /brouillon/ })).toBeNull()
|
||||
})
|
||||
|
||||
it('historical sheet: the working copy action disabled while a copy is active', async () => {
|
||||
fake.rpcResults.get_official_sheet_admin = {
|
||||
data: {
|
||||
@@ -965,7 +986,7 @@ describe('Sheet overview (H3)', () => {
|
||||
await user.click(dialog.getByRole('button', { name: 'Créer la copie' }))
|
||||
await waitFor(() =>
|
||||
expect(screen.getByTestId('where')).toHaveTextContent(
|
||||
`/app/admin/sheets/${NEW_ID}`,
|
||||
`/app/admin/sheets/${NEW_ID}/draft`,
|
||||
),
|
||||
)
|
||||
expect(rpcArgs('create_sheet_working_copy')).toEqual([
|
||||
|
||||
Reference in new issue
Block a user