refactor(editor): rename the reference panel's place to citations
Frees the name « references » for the fifth tab (R2.1). The panel's
data-place, PlaceName and ids become citations; no visible change.
EditorTarget, move kind, i18n keys and domain fields keep their names
(removed in R2.1).
R-24 (no assertion removed or weakened): unit editor-route, no-loss,
references-panel, route-recovery ids editor-references-* -> editor-citations-*;
keep-alive inPlace/place('references') -> 'citations'; focus-request
ownedBy 'references' -> 'citations'. e2e support openReferences /
closeReferences, crossing 204/271, journeys 247, layout 234/305,
deselect 229, shell 135 -> place 'citations'; crossing 205 searchbox and
structures 95 « citée 0 fois » -> libraryRoot(page) (new helper).
Gates: typecheck, lint, test:run (app 1382), build, e2e:ui 251 passed,
e2e:shell 7 specs 63 passed / 63 skipped on db:sandbox (editor-equine
not listed); full-row guard: no pre-existing row changed in any table.
This commit is contained in:
1 parent
65a8fd37b8
commit
fc3fec7654
18 files changed
+46
-40
No files matched your search
@@ -223,7 +223,7 @@ describe('ownedBy', () => {
|
||||
expect(ownedBy(view, 'annotations.drawing')).toBeUndefined()
|
||||
expect(ownedBy(view, 'general')).toBeUndefined()
|
||||
const ref = request({ kind: 'reference', id: 'ref-a' })
|
||||
expect(ownedBy(ref, 'references')).toBe(ref)
|
||||
expect(ownedBy(ref, 'citations')).toBe(ref)
|
||||
expect(ownedBy(ref, 'findings')).toBeUndefined()
|
||||
expect(ownedBy(undefined, 'general')).toBeUndefined()
|
||||
})
|
||||
|
||||
@@ -178,12 +178,12 @@ describe('text typed in a place that is left', () => {
|
||||
it('the reference add form survives closing and reopening the panel', async () => {
|
||||
const user = await mount()
|
||||
await user.click(referencesButton())
|
||||
const field = inPlace('references').getByLabelText('Citation', {
|
||||
const field = inPlace('citations').getByLabelText('Citation', {
|
||||
selector: '#reference-new-citation',
|
||||
})
|
||||
await user.type(field, 'Smith 1999')
|
||||
await user.click(referencesButton())
|
||||
expect(place('references')).not.toBeVisible()
|
||||
expect(place('citations')).not.toBeVisible()
|
||||
await user.click(referencesButton())
|
||||
expect(field).toHaveValue('Smith 1999')
|
||||
expect(store.getState().unsaved).toBe(false)
|
||||
@@ -311,7 +311,7 @@ describe('a field still focused while a place is left', () => {
|
||||
const before = store.getState().documentText
|
||||
await user.click(tab(/Vérification/))
|
||||
await user.click(referencesButton())
|
||||
const field = inPlace('references').getByLabelText('Citation', {
|
||||
const field = inPlace('citations').getByLabelText('Citation', {
|
||||
selector: '#reference-ref-1-citation',
|
||||
})
|
||||
await user.click(field)
|
||||
@@ -325,7 +325,7 @@ describe('a field still focused while a place is left', () => {
|
||||
JSON.parse(store.getState().documentText).references[0].citation,
|
||||
).toBe('Doe 2023')
|
||||
expect(store.getState().unsaved).toBe(true)
|
||||
expect(place('references')).not.toBeVisible()
|
||||
expect(place('citations')).not.toBeVisible()
|
||||
act(() => void store.getState().undoStep())
|
||||
expect(store.getState().documentText).toBe(before)
|
||||
})
|
||||
@@ -333,13 +333,13 @@ describe('a field still focused while a place is left', () => {
|
||||
it('Escape in a reference field commits the text before the panel hides', async () => {
|
||||
const user = await mount(referenceText())
|
||||
await user.click(referencesButton())
|
||||
const field = inPlace('references').getByLabelText('Citation', {
|
||||
const field = inPlace('citations').getByLabelText('Citation', {
|
||||
selector: '#reference-ref-1-citation',
|
||||
})
|
||||
await user.click(field)
|
||||
fireEvent.change(field, { target: { value: 'Doe 2021' } })
|
||||
await user.keyboard('{Escape}')
|
||||
expect(place('references')).not.toBeVisible()
|
||||
expect(place('citations')).not.toBeVisible()
|
||||
const doc: AnatomicalSheetDocument = JSON.parse(
|
||||
store.getState().documentText,
|
||||
)
|
||||
@@ -350,13 +350,13 @@ describe('a field still focused while a place is left', () => {
|
||||
it('the header toggle (no focus move) closes the panel after committing', async () => {
|
||||
const user = await mount(referenceText())
|
||||
await user.click(referencesButton())
|
||||
const field = inPlace('references').getByLabelText('Citation', {
|
||||
const field = inPlace('citations').getByLabelText('Citation', {
|
||||
selector: '#reference-ref-1-citation',
|
||||
})
|
||||
await user.click(field)
|
||||
fireEvent.change(field, { target: { value: 'Doe 2022' } })
|
||||
fireEvent.click(referencesButton())
|
||||
expect(place('references')).not.toBeVisible()
|
||||
expect(place('citations')).not.toBeVisible()
|
||||
expect(
|
||||
JSON.parse(store.getState().documentText).references[0].citation,
|
||||
).toBe('Doe 2022')
|
||||
|
||||
@@ -293,7 +293,7 @@ describe('the guards of a width change', () => {
|
||||
it('the references search, shown in both modes, keeps its focus and its text', async () => {
|
||||
const user = await mount()
|
||||
await user.click(button('Références'))
|
||||
const panel = screen.getByTestId('editor-references-panel')
|
||||
const panel = screen.getByTestId('editor-citations-panel')
|
||||
const search = within(panel).getByRole('searchbox', {
|
||||
name: 'Rechercher une référence',
|
||||
})
|
||||
|
||||
@@ -83,7 +83,7 @@ function sheetText(): string {
|
||||
const ready = () =>
|
||||
screen.findByRole('heading', { level: 1, name: 'Brouillon, version 4' })
|
||||
const header = () => screen.getByRole('button', { name: 'Références' })
|
||||
const panel = () => screen.getByTestId('editor-references-panel')
|
||||
const panel = () => screen.getByTestId('editor-citations-panel')
|
||||
const cards = () => within(panel()).getAllByRole('listitem')
|
||||
const search = () =>
|
||||
within(panel()).getByRole('searchbox', { name: 'Rechercher une référence' })
|
||||
|
||||
@@ -91,9 +91,9 @@ describe('the blocking offer', () => {
|
||||
expect(useLeaveGuardStore.getState().armed).toBe(true)
|
||||
// consultation: tabs still switch
|
||||
await user.click(screen.getByRole('button', { name: 'Références' }))
|
||||
expect(screen.getByTestId('editor-references-panel')).toHaveAttribute(
|
||||
expect(screen.getByTestId('editor-citations-panel')).toHaveAttribute(
|
||||
'aria-labelledby',
|
||||
'editor-references-title',
|
||||
'editor-citations-title',
|
||||
)
|
||||
// editing: refused by the store, no save offered
|
||||
expect(commitMove(40)).toMatchObject({
|
||||
|
||||
@@ -173,9 +173,9 @@ describe('references panel', () => {
|
||||
mountDraft()
|
||||
await ready()
|
||||
expect(button()).toHaveAttribute('aria-expanded', 'false')
|
||||
expect(screen.queryByTestId('editor-references-panel')).toBeNull()
|
||||
expect(screen.queryByTestId('editor-citations-panel')).toBeNull()
|
||||
await user.click(button())
|
||||
const panel = screen.getByTestId('editor-references-panel')
|
||||
const panel = screen.getByTestId('editor-citations-panel')
|
||||
expect(panel).toBeVisible()
|
||||
expect(button()).toHaveAttribute('aria-expanded', 'true')
|
||||
expect(document.activeElement).toBe(
|
||||
@@ -197,11 +197,11 @@ describe('references panel', () => {
|
||||
mountDraft()
|
||||
await ready()
|
||||
await user.click(button())
|
||||
const panel = screen.getByTestId('editor-references-panel')
|
||||
const panel = screen.getByTestId('editor-citations-panel')
|
||||
await user.keyboard('{Escape}')
|
||||
expect(panel).not.toBeVisible()
|
||||
await user.click(button())
|
||||
expect(screen.getByTestId('editor-references-panel')).toBe(panel)
|
||||
expect(screen.getByTestId('editor-citations-panel')).toBe(panel)
|
||||
expect(panel).toBeVisible()
|
||||
})
|
||||
|
||||
@@ -210,7 +210,7 @@ describe('references panel', () => {
|
||||
mountDraft({ width: 800 })
|
||||
await ready()
|
||||
await user.click(button())
|
||||
const panel = screen.getByTestId('editor-references-panel')
|
||||
const panel = screen.getByTestId('editor-citations-panel')
|
||||
expect(within(panel).queryByRole('textbox')).toBeNull()
|
||||
expect(
|
||||
within(panel).queryByRole('button', { name: 'Ajouter la référence' }),
|
||||
|
||||
Reference in new issue
Block a user