fix: footer showing up on new RWD challenges (#44562)
This commit is contained in:
@ -7,11 +7,23 @@ const pathnames = {
|
|||||||
challenge:
|
challenge:
|
||||||
'/learn/responsive-web-design/basic-html-and-html5/say-hello-to-html-elements'
|
'/learn/responsive-web-design/basic-html-and-html5/say-hello-to-html-elements'
|
||||||
},
|
},
|
||||||
|
englishWithYear: {
|
||||||
|
landing: '/',
|
||||||
|
superBlock: '/learn/2022/responsive-web-design',
|
||||||
|
challenge:
|
||||||
|
'/learn/2022/responsive-web-design/basic-html-and-html5/say-hello-to-html-elements'
|
||||||
|
},
|
||||||
espanol: {
|
espanol: {
|
||||||
landing: '/espanol',
|
landing: '/espanol',
|
||||||
superBlock: '/espanol/learn/responsive-web-design',
|
superBlock: '/espanol/learn/responsive-web-design',
|
||||||
challenge:
|
challenge:
|
||||||
'/espanol/learn/responsive-web-design/basic-html-and-html5/say-hello-to-html-elements'
|
'/espanol/learn/responsive-web-design/basic-html-and-html5/say-hello-to-html-elements'
|
||||||
|
},
|
||||||
|
espanolWithYear: {
|
||||||
|
landing: '/espanol',
|
||||||
|
superBlock: '/espanol/learn/2022/responsive-web-design',
|
||||||
|
challenge:
|
||||||
|
'/espanol/learn/2022/responsive-web-design/basic-html-and-html5/say-hello-to-html-elements'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -37,6 +49,12 @@ describe('isLanding', () => {
|
|||||||
it('returns false for English challenge pathname', () => {
|
it('returns false for English challenge pathname', () => {
|
||||||
expect(isLanding(pathnames.english.challenge)).toBe(false);
|
expect(isLanding(pathnames.english.challenge)).toBe(false);
|
||||||
});
|
});
|
||||||
|
it('returns false for English with year challenge pathname', () => {
|
||||||
|
expect(isLanding(pathnames.englishWithYear.challenge)).toBe(false);
|
||||||
|
});
|
||||||
|
it('returns false for Espanol with year challenge pathname', () => {
|
||||||
|
expect(isLanding(pathnames.espanolWithYear.challenge)).toBe(false);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('isChallenge', () => {
|
describe('isChallenge', () => {
|
||||||
@ -61,4 +79,10 @@ describe('isChallenge', () => {
|
|||||||
it('returns true for English challenge pathname', () => {
|
it('returns true for English challenge pathname', () => {
|
||||||
expect(isChallenge(pathnames.english.challenge)).toBe(true);
|
expect(isChallenge(pathnames.english.challenge)).toBe(true);
|
||||||
});
|
});
|
||||||
|
it('returns true for English with year challenge pathname', () => {
|
||||||
|
expect(isChallenge(pathnames.englishWithYear.challenge)).toBe(true);
|
||||||
|
});
|
||||||
|
it('returns true for Espanol with year challenge pathname', () => {
|
||||||
|
expect(isChallenge(pathnames.espanolWithYear.challenge)).toBe(true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -7,8 +7,14 @@ const splitPath = (pathname: string): string[] =>
|
|||||||
export const isChallenge = (pathname: string): boolean => {
|
export const isChallenge = (pathname: string): boolean => {
|
||||||
const pathArray = splitPath(pathname);
|
const pathArray = splitPath(pathname);
|
||||||
return (
|
return (
|
||||||
(pathArray.length === 4 && pathArray[0]) === 'learn' ||
|
// learn/<superBlock>/<block>/<challenge>
|
||||||
(pathArray.length === 5 && pathArray[1]) === 'learn'
|
(pathArray.length === 4 && pathArray[0] === 'learn') ||
|
||||||
|
// learn/<year>/<superBlock>/<block>/<challenge>
|
||||||
|
(pathArray.length === 5 && pathArray[0] === 'learn') ||
|
||||||
|
// <i18n>/learn/<superBlock>/<block>/<challenge>
|
||||||
|
(pathArray.length === 5 && pathArray[1] === 'learn') ||
|
||||||
|
// <i18n>/learn/<year>/<superBlock>/<block>/<challenge>
|
||||||
|
(pathArray.length === 6 && pathArray[1] === 'learn')
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user