feat: update titles for certification pages (#42252)

* feat: update titles for certification pages

* fix: update titles in Cypress tests

* fix: change "certificate" to "certification" in intro-page.js test file

* fix: prevent adding "Certification" to title for interview prep, make variable name more clear

* feat: add test for coding interview prep page title
This commit is contained in:
Kristofer Koishigawa
2021-06-04 19:04:02 +09:00
committed by GitHub
parent fa594cf7f5
commit e82f5f4425
4 changed files with 36 additions and 5 deletions

View File

@ -148,11 +148,17 @@ class SuperBlockIntroductionPage extends Component {
const nodesForSuperBlock = edges.map(({ node }) => node); const nodesForSuperBlock = edges.map(({ node }) => node);
const blockDashedNames = uniq(nodesForSuperBlock.map(({ block }) => block)); const blockDashedNames = uniq(nodesForSuperBlock.map(({ block }) => block));
const i18nSuperBlock = t(`intro:${superBlock}.title`); const i18nSuperBlock = t(`intro:${superBlock}.title`);
const i18nTitle =
superBlock === 'coding-interview-prep'
? i18nSuperBlock
: t(`intro:misc-text.certification`, {
cert: i18nSuperBlock
});
return ( return (
<> <>
<Helmet> <Helmet>
<title>{i18nSuperBlock} | freeCodeCamp.org</title> <title>{i18nTitle} | freeCodeCamp.org</title>
</Helmet> </Helmet>
<Grid> <Grid>
<Row className='super-block-intro-page'> <Row className='super-block-intro-page'>

View File

@ -0,0 +1,19 @@
/* global cy */
describe('Certification intro page', () => {
before(() => {
cy.clearCookies();
cy.login();
cy.visit('/learn/coding-interview-prep');
});
it('Should render', () => {
cy.contains(
"If you're looking for free coding exercises to prepare for your next job interview, we've got you covered."
).should('be.visible');
});
it('Title should not include the word "Certification"', () => {
cy.title().should('eq', 'Coding Interview Prep | freeCodeCamp.org');
});
});

View File

@ -17,7 +17,10 @@ describe('challenges/superblock redirect', function () {
it('redirects to learn/superblock', () => { it('redirects to learn/superblock', () => {
cy.visit(locations.chalSuper); cy.visit(locations.chalSuper);
cy.title().should('eq', 'Responsive Web Design | freeCodeCamp.org'); cy.title().should(
'eq',
'Responsive Web Design Certification | freeCodeCamp.org'
);
cy.location().should(loc => { cy.location().should(loc => {
expect(loc.pathname).to.eq(locations.learnSuper); expect(loc.pathname).to.eq(locations.learnSuper);
}); });

View File

@ -4,7 +4,7 @@ const selectors = {
firstBlock: '.block-ui > .block:nth-child(1) > .map-title' firstBlock: '.block-ui > .block:nth-child(1) > .map-title'
}; };
describe('Certificate intro page', () => { describe('Certification intro page', () => {
before(() => { before(() => {
cy.clearCookies(); cy.clearCookies();
cy.login(); cy.login();
@ -12,10 +12,13 @@ describe('Certificate intro page', () => {
}); });
it('Should render', () => { it('Should render', () => {
cy.title().should('eq', 'Responsive Web Design | freeCodeCamp.org'); cy.title().should(
'eq',
'Responsive Web Design Certification | freeCodeCamp.org'
);
}); });
it('Should have certificate intro text', () => { it('Should have certification intro text', () => {
cy.contains( cy.contains(
"In this Responsive Web Design Certification, you'll learn the languages that developers use to build webpages" "In this Responsive Web Design Certification, you'll learn the languages that developers use to build webpages"
).should('be.visible'); ).should('be.visible');