mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-19 18:18:27 -05:00
fix(client): Change reset lesson message to be dynamic (#59400)
Co-authored-by: Ilenia <26656284+ilenia-magoni@users.noreply.github.com> Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com>
This commit is contained in:
@@ -445,7 +445,7 @@
|
|||||||
"rsa": "Read, search, ask",
|
"rsa": "Read, search, ask",
|
||||||
"rsa-forum": "<strong>Before making a new post</strong> please <0>check if your question has already been answered on the forum</0>.",
|
"rsa-forum": "<strong>Before making a new post</strong> please <0>check if your question has already been answered on the forum</0>.",
|
||||||
"reset": "Reset this lesson?",
|
"reset": "Reset this lesson?",
|
||||||
"reset-warn": "Are you sure you wish to reset this lesson? The editors and tests will be reset.",
|
"reset-warn": "Are you sure you wish to reset this lesson ({{title}})? The code editors and tests will be reset.",
|
||||||
"reset-warn-2": "This cannot be undone.",
|
"reset-warn-2": "This cannot be undone.",
|
||||||
"revert-warn": "Are you sure you wish to revert this lesson? Your latest changes will be undone and the code reverted to the most recently saved version.",
|
"revert-warn": "Are you sure you wish to revert this lesson? Your latest changes will be undone and the code reverted to the most recently saved version.",
|
||||||
"scrimba-tip": "Tip: If the mini-browser is covering the code, click and drag to move it. Also, feel free to stop and edit the code in the video at any time.",
|
"scrimba-tip": "Tip: If the mini-browser is covering the code, click and drag to move it. Also, feel free to stop and edit the code in the video at any time.",
|
||||||
|
|||||||
@@ -528,7 +528,7 @@ function ShowClassic({
|
|||||||
superBlock={superBlock}
|
superBlock={superBlock}
|
||||||
/>
|
/>
|
||||||
<VideoModal videoUrl={videoUrl} />
|
<VideoModal videoUrl={videoUrl} />
|
||||||
<ResetModal challengeType={challengeType} />
|
<ResetModal challengeType={challengeType} challengeTitle={title} />
|
||||||
<ProjectPreviewModal
|
<ProjectPreviewModal
|
||||||
challengeData={challengeData}
|
challengeData={challengeData}
|
||||||
closeText={t('buttons.start-coding')}
|
closeText={t('buttons.start-coding')}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ interface ResetModalProps {
|
|||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
challengeType: number;
|
challengeType: number;
|
||||||
reset: () => void;
|
reset: () => void;
|
||||||
|
challengeTitle: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapStateToProps = createSelector(
|
const mapStateToProps = createSelector(
|
||||||
@@ -41,7 +42,8 @@ function ResetModal({
|
|||||||
reset,
|
reset,
|
||||||
close,
|
close,
|
||||||
challengeType,
|
challengeType,
|
||||||
isOpen
|
isOpen,
|
||||||
|
challengeTitle
|
||||||
}: ResetModalProps): JSX.Element {
|
}: ResetModalProps): JSX.Element {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
@@ -56,7 +58,9 @@ function ResetModal({
|
|||||||
<p>
|
<p>
|
||||||
{canSaveToDB(challengeType)
|
{canSaveToDB(challengeType)
|
||||||
? t('learn.revert-warn')
|
? t('learn.revert-warn')
|
||||||
: t('learn.reset-warn')}
|
: t('learn.reset-warn', {
|
||||||
|
title: challengeTitle
|
||||||
|
})}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<em>{t('learn.reset-warn-2')}</em>
|
<em>{t('learn.reset-warn-2')}</em>
|
||||||
|
|||||||
@@ -42,7 +42,11 @@ test('should render the modal content correctly', async ({ page }) => {
|
|||||||
})
|
})
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
|
|
||||||
await expect(page.getByText(translations.learn['reset-warn'])).toBeVisible();
|
await expect(
|
||||||
|
page.getByText(
|
||||||
|
'Are you sure you wish to reset this lesson (Step 3)? The code editors and tests will be reset.'
|
||||||
|
)
|
||||||
|
).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('User can reset challenge', async ({ page, isMobile, browserName }) => {
|
test('User can reset challenge', async ({ page, isMobile, browserName }) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user