Skip to content

Commit

Permalink
fix: restore missing reset button (#54389)
Browse files Browse the repository at this point in the history
Co-authored-by: Manabu Matsumoto <mmatsumoto1026@gmail.com>
  • Loading branch information
a2937 and mmatsumoto1026 committed Apr 19, 2024
1 parent 805be1d commit b07e7c8
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 9 deletions.
6 changes: 6 additions & 0 deletions client/src/templates/Challenges/components/tool-panel.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,9 @@
.tool-panel-group-mobile *:focus-visible {
outline-offset: -3px;
}

@media screen and (max-width: 450px) {
#get-help-dropdown {
min-width: 90px;
}
}
17 changes: 8 additions & 9 deletions client/src/templates/Challenges/components/tool-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,14 @@ function ToolPanel({
</Button>
</>
)}
{challengeType !== challengeTypes.multifileCertProject &&
challengeType !== challengeTypes.multifilePythonCertProject && (
<>
<Spacer size='xxSmall' />
<Button block={true} variant='primary' onClick={openResetModal}>
{isMobile ? t('buttons.reset') : t('buttons.reset-lesson')}
</Button>
</>
)}
{challengeType !== challengeTypes.multifilePythonCertProject && (
<>
<Spacer size='xxSmall' />
<Button block={true} variant='primary' onClick={openResetModal}>
{isMobile ? t('buttons.reset') : t('buttons.reset-lesson')}
</Button>
</>
)}
<Spacer size='xxSmall' />
<Dropdown dropup>
<Dropdown.Toggle
Expand Down
39 changes: 39 additions & 0 deletions e2e/reset-modal.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,42 @@ test('should close when the user clicks the close button', async ({ page }) => {
page.getByRole('dialog', { name: translations.learn.reset })
).toBeHidden();
});

test('User can reset on a multi-file project', async ({ page }) => {
{
await page.goto(
'/learn/javascript-algorithms-and-data-structures-v8/build-a-palindrome-checker-project/build-a-palindrome-checker'
);
await page
.getByRole('button', { name: translations.buttons.reset })
.click();

await expect(
page.getByRole('dialog', { name: translations.learn.reset })
).toBeVisible();

await expect(
page.getByRole('button', {
name: translations.buttons.close
})
).toBeVisible();
await expect(
page.getByRole('heading', {
name: translations.learn.reset
})
).toBeVisible();

await expect(
page.getByText(translations.learn['reset-warn'])
).toBeVisible();
await expect(
page.getByText(translations.learn['reset-warn-2'])
).toBeVisible();

await expect(
page.getByRole('button', {
name: translations.buttons['reset-lesson']
})
).toBeVisible();
}
});

0 comments on commit b07e7c8

Please sign in to comment.