Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/freeCodeCamp/freeCodeCamp i…
Browse files Browse the repository at this point in the history
…nto pr/54179
  • Loading branch information
huyenltnguyen committed Apr 3, 2024
2 parents b46167b + 5013ba0 commit 406d31e
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 61 deletions.
109 changes: 54 additions & 55 deletions client/src/components/settings/certification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -334,26 +334,30 @@ function CertificationSettings(props: CertificationSettingsProps) {
}) => {
const { certSlug } = certsToProjects[certName][0];
return (
<FullWidthRow>
<Spacer size='medium' />
<h3 className='text-center' id={`cert-${certSlug}`}>
{t(`certification.title.${certName}`, certName)}
</h3>
<Table>
<thead>
<tr>
<th>{t('settings.labels.project-name')}</th>
<th>{t('settings.labels.solution')}</th>
</tr>
</thead>
<tbody>
<ProjectsFor
certName={certName}
isCert={getUserIsCertMap()[certName]}
/>
</tbody>
</Table>
</FullWidthRow>
<ScrollableAnchor id={`cert-${certSlug}`}>
<section>
<FullWidthRow>
<Spacer size='medium' />
<h3 className='text-center'>
{t(`certification.title.${certName}`, certName)}
</h3>
<Table>
<thead>
<tr>
<th>{t('settings.labels.project-name')}</th>
<th>{t('settings.labels.solution')}</th>
</tr>
</thead>
<tbody>
<ProjectsFor
certName={certName}
isCert={getUserIsCertMap()[certName]}
/>
</tbody>
</Table>
</FullWidthRow>
</section>
</ScrollableAnchor>
);
};

Expand Down Expand Up @@ -413,43 +417,38 @@ function CertificationSettings(props: CertificationSettingsProps) {
const { t } = props;

return (
<ScrollableAnchor id='certification-settings'>
<section className='certification-settings'>
<SectionHeader>{t('settings.headings.certs')}</SectionHeader>
{currentCertTitles.map(title => (
<Certification key={title} certName={title} t={t} />
))}
<Spacer size='medium' />
<SectionHeader>{t('settings.headings.legacy-certs')}</SectionHeader>
<LegacyFullStack {...props} />
{legacyCertTitles.map(title => (
<section className='certification-settings'>
<SectionHeader>{t('settings.headings.certs')}</SectionHeader>
{currentCertTitles.map(title => (
<Certification key={title} certName={title} t={t} />
))}
<Spacer size='medium' />
<SectionHeader>{t('settings.headings.legacy-certs')}</SectionHeader>
<LegacyFullStack {...props} />
{legacyCertTitles.map(title => (
<Certification key={title} certName={title} t={t} />
))}
{showUpcomingChanges &&
upcomingCertTitles.map(title => (
<Certification key={title} certName={title} t={t} />
))}
{showUpcomingChanges &&
upcomingCertTitles.map(title => (
<Certification key={title} certName={title} t={t} />
))}
<ProjectModal
{...{
projectTitle,
challengeFiles,
solution: solution ?? undefined,
isOpen
}}
handleSolutionModalHide={handleSolutionModalHide}
/>
<ProjectPreviewModal
challengeData={challengeData}
previewTitle={projectTitle}
closeText={t('buttons.close')}
showProjectPreview={true}
/>
<ExamResultsModal
projectTitle={projectTitle}
examResults={examResults}
/>
</section>
</ScrollableAnchor>
<ProjectModal
{...{
projectTitle,
challengeFiles,
solution: solution ?? undefined,
isOpen
}}
handleSolutionModalHide={handleSolutionModalHide}
/>
<ProjectPreviewModal
challengeData={challengeData}
previewTitle={projectTitle}
closeText={t('buttons.close')}
showProjectPreview={true}
/>
<ExamResultsModal projectTitle={projectTitle} examResults={examResults} />
</section>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const CertChallenge = ({
<Button
block={true}
variant='primary'
href={isCertified ? certLocation : `/settings#certification-settings`}
href={isCertified ? certLocation : `/settings#cert-${certSlug}`}
onClick={() => (isCertified ? createClickHandler(certSlug) : false)}
>
{isCertified && userLoaded
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,12 @@ describe('Front End Development Libraries Superblock', () => {
cy.visit('/learn/front-end-development-libraries');
});
describe('Before submitting projects', () => {
it('should navigate to "/settings#certification-settings" when clicking the "Go to settings to claim your certification" anchor', () => {
it('should navigate to "/settings#cert-front-end-development-libraries" when clicking the "Go to settings to claim your certification" anchor', () => {
cy.contains('Go to settings to claim your certification').click();
cy.url().should('match', /\/settings\/?#certification-settings/);
cy.url().should(
'match',
/\/settings\/?#cert-front-end-development-libraries/
);
});
});

Expand Down
6 changes: 3 additions & 3 deletions e2e/exam-results-modal.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test.describe('Exam results modal', () => {
await expect(viewButton).toBeVisible();
await viewButton.click();

await expect(page.getByRole('dialog')).toHaveCount(2);
await expect(page.getByRole('dialog')).toHaveCount(1);

await expect(
page.getByRole('heading', {
Expand All @@ -36,7 +36,7 @@ test.describe('Exam results modal', () => {
await expect(viewButton).toBeVisible();
await viewButton.click();

await expect(page.getByRole('dialog')).toHaveCount(2);
await expect(page.getByRole('dialog')).toHaveCount(1);

// There are 2 close buttons on the page, and the x button is the first
const closeButton = page.getByRole('button', { name: 'Close' }).first();
Expand All @@ -52,7 +52,7 @@ test.describe('Exam results modal', () => {
await expect(viewButton).toBeVisible();
await viewButton.click();

await expect(page.getByRole('dialog')).toHaveCount(2);
await expect(page.getByRole('dialog')).toHaveCount(1);

// There are 2 close buttons on the page, and the close button is the last
const closeButton = page.getByRole('button', { name: 'Close' }).last();
Expand Down

0 comments on commit 406d31e

Please sign in to comment.