fix(editor): Task 8 round 2, cascade closes the sheet
This commit is contained in:
1 parent
579d8afff4
commit
791fc03a0d
7 files changed
+205
-10
No files matched your search
@@ -13,6 +13,7 @@ import {
|
||||
openTab,
|
||||
referenceDialog,
|
||||
seedDraft,
|
||||
showCitations,
|
||||
standardShape,
|
||||
startReference,
|
||||
} from '../support/editor'
|
||||
@@ -162,4 +163,48 @@ test.describe('leaving the editor by a history jump', () => {
|
||||
await reopenDraft(page)
|
||||
await expect(page.getByText(leftNotice)).toHaveCount(0)
|
||||
})
|
||||
|
||||
test('a dirty reference over the sheet of a dirty finding: both ask in turn', async ({
|
||||
page,
|
||||
context,
|
||||
}) => {
|
||||
test.setTimeout(150_000)
|
||||
const sheetId = await open(page)
|
||||
await openFinding(page, dict, 'Constat A')
|
||||
const finding = findingDialog(page)
|
||||
await finding
|
||||
.getByRole('button', { name: dict['editor.findings.edit'], exact: true })
|
||||
.click()
|
||||
const name = finding.getByLabel(dict['editor.general.name_fr'])
|
||||
await name.fill('Constat brouillon')
|
||||
await showCitations(page)
|
||||
const panel = page.getByTestId('editor-citations-panel')
|
||||
await panel.locator('button[aria-controls][id$="-header"]').first().click()
|
||||
await panel
|
||||
.getByRole('button', { name: dict['editor.references.edit'] })
|
||||
.click()
|
||||
const form = referenceDialog(page)
|
||||
await form.getByLabel(dict['editor.reference.citation']).fill('Brouillon')
|
||||
await expect(page.locator('dialog[open]')).toHaveCount(3)
|
||||
|
||||
await jumpToOverview(context, page, sheetId)
|
||||
await expect(form.getByText(confirmText)).toBeVisible()
|
||||
await form
|
||||
.getByRole('button', { name: dict['editor.findings.discard'] })
|
||||
.click()
|
||||
await expect(page.locator('dialog[open]')).toHaveCount(1)
|
||||
await expect(finding.getByText(confirmText)).toBeVisible()
|
||||
const keep = finding.getByRole('button', {
|
||||
name: dict['editor.findings.keep_typing'],
|
||||
})
|
||||
await expect(keep).toBeFocused()
|
||||
expect(new URL(page.url()).pathname).toBe(draftPath(sheetId))
|
||||
await finding
|
||||
.getByRole('button', { name: dict['editor.findings.discard'] })
|
||||
.click()
|
||||
await expect(page).toHaveURL(
|
||||
(url) => url.pathname === overviewPath(sheetId),
|
||||
)
|
||||
expect(await leftFlags(page)).toBe(0)
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user