Repository navigation
fix(projects): show the project name in the delete confirmation - #1827
Conversation
chrisvel
left a comment
There was a problem hiding this comment.
Thanks, this is the right fix: passing projectName through t() is all the locales that use the placeholder needed, and the two tests pin it down nicely.
One thing before merging: main changed the project menu button since this branch was cut, so the ProjectDetails test fails after a merge with main (the ProjectModal one is fine). See the inline note, it is a one-word change. I ran both tests on a local merge with main and they pass with it.
| expect(screen.getByText('Apollo Moon Mission')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| fireEvent.click(screen.getByTitle('More options')); |
There was a problem hiding this comment.
On current main this button only has an aria-label (the title went away in #1832), so this throws Unable to find an element with the title: More options. screen.getByLabelText('More options') finds it.
|
Thanks for the review, and for landing the fix in #1857. That covers #1826, so the component change here is redundant now. #1857 mentions that no regression test went in because the test mock doesn't interpolate. The two tests in this PR do check that |
bbc1b37 to
3ebf0b6
Compare
chore: sync upstream 612145b..7d4c263 (v1.9.2, chrisvel#1647, chrisvel#1827, chrisvel#1863, chrisvel#1878, chrisvel#1886, chrisvel#1897-chrisvel#1900)
Description
In
ProjectDetails.tsxandProjectModal.tsx, the delete confirmation dialog calledt('modals.deleteProject.message', ...)without supplying interpolation parameters. In 23 non-English locales (such as Polish, German, and French),modals.deleteProject.messagecontains{{projectName}}, which caused the dialog to render the literal placeholder"{{projectName}}"instead of the project name.This updates both call sites to pass
projectName: project?.namealongside the EnglishdefaultValue.Type of Change
Related Issues
Fixes #1826
Testing
How did you test this?
Added unit tests covering delete confirmation dialog rendering and variable interpolation in
ProjectDetailsandProjectModal:npx jest frontend/components/Project/__tests__/ProjectModal.test.tsx frontend/components/Project/__tests__/ProjectDetails.test.tsxnpx eslint frontend/components/Project/ProjectModal.tsx frontend/components/Project/ProjectDetails.tsx frontend/components/Project/__tests__/ProjectModal.test.tsx frontend/components/Project/__tests__/ProjectDetails.test.tsxnpx prettier --check frontend/components/Project/ProjectModal.tsx frontend/components/Project/ProjectDetails.tsx frontend/components/Project/__tests__/ProjectModal.test.tsx frontend/components/Project/__tests__/ProjectDetails.test.tsxChecklist