feat: render footer correctly (#42096)
Co-authored-by: Ahmad Abdolsaheb <ahmad.abdolsaheb@gmail.com>
This commit is contained in:
@ -26,11 +26,12 @@ export default function layoutSelector({ element, props }) {
|
||||
}
|
||||
|
||||
const splitPath = pathname.split('/').filter(x => x);
|
||||
const isSuperBlock =
|
||||
(splitPath.length === 2 && splitPath[0]) === 'learn' ||
|
||||
(splitPath.length === 3 && splitPath[1]) === 'learn';
|
||||
|
||||
if (/\/learn\//.test(pathname) && !isSuperBlock) {
|
||||
const isChallenge =
|
||||
(splitPath.length === 4 && splitPath[0]) === 'learn' ||
|
||||
(splitPath.length === 5 && splitPath[1]) === 'learn';
|
||||
|
||||
if (isChallenge) {
|
||||
return (
|
||||
<DefaultLayout pathname={pathname} showFooter={false}>
|
||||
{element}
|
||||
|
31
cypress/integration/learn/common-components/footer.js
Normal file
31
cypress/integration/learn/common-components/footer.js
Normal file
@ -0,0 +1,31 @@
|
||||
/* global cy */
|
||||
|
||||
const selectors = {
|
||||
footer: '.site-footer'
|
||||
};
|
||||
|
||||
describe('Footer', () => {
|
||||
it('Should render on landing page', () => {
|
||||
cy.visit('/');
|
||||
cy.get(selectors.footer).should('be.visible');
|
||||
});
|
||||
|
||||
it('Should render on learn page', () => {
|
||||
cy.visit('/learn');
|
||||
cy.get(selectors.footer).should('be.visible');
|
||||
cy.visit('/learn/');
|
||||
cy.get(selectors.footer).should('be.visible');
|
||||
});
|
||||
|
||||
it('Should render on superblock page', () => {
|
||||
cy.visit('/learn/responsive-web-design/');
|
||||
cy.get(selectors.footer).should('be.visible');
|
||||
});
|
||||
|
||||
it('Should not render on challenge page', () => {
|
||||
cy.visit(
|
||||
'/learn/responsive-web-design/basic-html-and-html5/say-hello-to-html-elements'
|
||||
);
|
||||
cy.get(selectors.footer).should('not.exist');
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user