feat(app): history reads Défaire / Refaire (R1, D5)
FR names Défaire / Refaire; title = name + shortcut (Ctrl+Z ou ⌘Z /
Ctrl+Maj+Z ou ⇧⌘Z), aria-label = name, aria-keyshortcuts adds Meta forms.
New keys editor.history.{undo,redo}_shortcut (fr, en). FR prose use_parent_body
and repair.body_one/_other say Défaire. Dialog Annuler unchanged.
Assertion map (R-24):
- editor-history-buttons.test.tsx UNDO/REDO constants 'Annuler la dernière
modification' / 'Rétablir la dernière modification annulée' → 'Défaire la
dernière modification' / 'Refaire la dernière modification défaite'
- :80-81 title === UNDO/REDO → title `${UNDO} (Ctrl+Z ou ⌘Z)` / `${REDO}
(Ctrl+Maj+Z ou ⇧⌘Z)`
- :82-83 aria-keyshortcuts 'Control+Z' / 'Control+Shift+Z' → 'Control+Z
Meta+Z' / 'Control+Shift+Z Meta+Shift+Z'
- visible labels ['Annuler','Rétablir'] → ['Défaire','Refaire']
- tool column absence /Annuler|Rétablir/ → /Défaire|Refaire/ (also
editor-annotations-tab.test.tsx:514)
- Rétablir button lookup by literal name → REDO constant
- added: EN names unchanged with title '(Ctrl+Z or ⌘Z)'; FR prose contains
Défaire while use_parent_cancel stays 'Annuler'
- e2e titles/comments only: Annuler/Rétablir → Défaire/Refaire
This commit is contained in:
1 parent
5803854860
commit
7dda61d2ae
10 files changed
+70
-34
No files matched your search
@@ -1,4 +1,4 @@
|
||||
/** Lot E: the header « Annuler » / « Rétablir », the save line's announcements, discard. */
|
||||
/** Lot E: the header « Défaire » / « Refaire », the save line's announcements, discard. */
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import {
|
||||
act,
|
||||
@@ -11,7 +11,9 @@ import {
|
||||
} from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
import DeleteDialog from '@/components/editor/DeleteDialog'
|
||||
import { en } from '@/i18n/en'
|
||||
import { fr } from '@/i18n/fr'
|
||||
import { useLocaleStore } from '@/state/localeStore'
|
||||
import {
|
||||
baseText,
|
||||
commitMove,
|
||||
@@ -46,8 +48,8 @@ afterEach(() => {
|
||||
setWidth(1024)
|
||||
})
|
||||
|
||||
const UNDO = 'Annuler la dernière modification'
|
||||
const REDO = 'Rétablir la dernière modification annulée'
|
||||
const UNDO = 'Défaire la dernière modification'
|
||||
const REDO = 'Refaire la dernière modification défaite'
|
||||
const ready = () =>
|
||||
screen.findByRole('heading', { level: 1, name: 'Brouillon, version 4' })
|
||||
const undoButton = () => screen.getByRole('button', { name: UNDO })
|
||||
@@ -73,17 +75,47 @@ describe('the buttons', () => {
|
||||
mountDraft()
|
||||
await ready()
|
||||
const row = within(screen.getByTestId('history-buttons'))
|
||||
expect(undoButton()).toHaveAttribute('title', UNDO)
|
||||
expect(redoButton()).toHaveAttribute('title', REDO)
|
||||
expect(undoButton()).toHaveAttribute('aria-keyshortcuts', 'Control+Z')
|
||||
expect(redoButton()).toHaveAttribute('aria-keyshortcuts', 'Control+Shift+Z')
|
||||
expect(undoButton()).toHaveAttribute('title', `${UNDO} (Ctrl+Z ou ⌘Z)`)
|
||||
expect(redoButton()).toHaveAttribute('title', `${REDO} (Ctrl+Maj+Z ou ⇧⌘Z)`)
|
||||
expect(undoButton()).toHaveAttribute(
|
||||
'aria-keyshortcuts',
|
||||
'Control+Z Meta+Z',
|
||||
)
|
||||
expect(redoButton()).toHaveAttribute(
|
||||
'aria-keyshortcuts',
|
||||
'Control+Shift+Z Meta+Shift+Z',
|
||||
)
|
||||
expect(row.getAllByRole('button').map((b) => b.textContent)).toEqual([
|
||||
'Annuler',
|
||||
'Rétablir',
|
||||
'Défaire',
|
||||
'Refaire',
|
||||
])
|
||||
expect(undoButton()).not.toHaveAttribute('disabled')
|
||||
})
|
||||
|
||||
it('keep their English names and carry the English shortcut in the title', async () => {
|
||||
mountDraft()
|
||||
await ready()
|
||||
act(() => useLocaleStore.setState({ locale: 'en' }))
|
||||
const undo = screen.getByRole('button', {
|
||||
name: en['editor.history.undo_title'],
|
||||
})
|
||||
const redo = screen.getByRole('button', {
|
||||
name: en['editor.history.redo_title'],
|
||||
})
|
||||
expect(undo).toHaveAttribute('title', 'Undo the last change (Ctrl+Z or ⌘Z)')
|
||||
expect(redo).toHaveAttribute(
|
||||
'title',
|
||||
'Redo the last undone change (Ctrl+Shift+Z or ⇧⌘Z)',
|
||||
)
|
||||
})
|
||||
|
||||
it('French prose says « Défaire » while the dialog cancel stays « Annuler »', () => {
|
||||
expect(fr['editor.views.drawing.use_parent_body']).toContain('(Défaire)')
|
||||
expect(fr['editor.views.repair.body_one']).toContain('un seul Défaire')
|
||||
expect(fr['editor.views.repair.body_other']).toContain('un seul Défaire')
|
||||
expect(fr['editor.views.drawing.use_parent_cancel']).toBe('Annuler')
|
||||
})
|
||||
|
||||
it('are enabled exactly when the store can step, and step', async () => {
|
||||
const user = userEvent.setup()
|
||||
mountDraft()
|
||||
@@ -202,7 +234,7 @@ describe('the buttons', () => {
|
||||
name: fr['editor.annotations.tools'],
|
||||
})
|
||||
expect(
|
||||
within(tools).queryByRole('button', { name: /Annuler|Rétablir/ }),
|
||||
within(tools).queryByRole('button', { name: /Défaire|Refaire/ }),
|
||||
).toBeNull()
|
||||
})
|
||||
})
|
||||
@@ -315,7 +347,7 @@ describe('typed text and the press', () => {
|
||||
expect(store.getState().undo).toHaveLength(1)
|
||||
})
|
||||
|
||||
it('a field left through « Rétablir » to « Annuler » still skips the undo', async () => {
|
||||
it('a field left through « Refaire » to « Défaire » still skips the undo', async () => {
|
||||
const user = userEvent.setup()
|
||||
mountDraft()
|
||||
await ready()
|
||||
@@ -324,7 +356,7 @@ describe('typed text and the press', () => {
|
||||
await user.clear(field)
|
||||
field.blur()
|
||||
const redo = screen.getByRole('button', {
|
||||
name: 'Rétablir la dernière modification annulée',
|
||||
name: REDO,
|
||||
})
|
||||
act(() => redo.focus())
|
||||
fireEvent.focus(redo, { relatedTarget: field })
|
||||
@@ -489,7 +521,7 @@ describe('« Abandonner les modifications »', () => {
|
||||
).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('keeps the session\'s save in the save line, and the save line says it', async () => {
|
||||
it("keeps the session's save in the save line, and the save line says it", async () => {
|
||||
const user = userEvent.setup()
|
||||
sb.saveSheetDraft.mockResolvedValue({ revision: 4 } as never)
|
||||
sb.getOfficialSheetAdmin.mockRejectedValue(new Error('offline'))
|
||||
|
||||
Reference in new issue
Block a user