feat: add toggle nav (#36956)

* feat: re-add toggle menu

* Update client/src/components/Header/components/universalNav.css

Co-Authored-By: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>

* Update client/src/components/Header/components/universalNav.css

Co-Authored-By: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>

* Update client/src/components/Header/components/universalNav.css

Co-Authored-By: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>

* fix: fix lint error
This commit is contained in:
Ahmad Abdolsaheb
2019-10-04 18:00:17 +03:00
committed by mrugesh
parent 2066ed674b
commit f9a112b43e
7 changed files with 250 additions and 91 deletions

View File

@ -2,19 +2,17 @@
import React from 'react';
import ShallowRenderer from 'react-test-renderer/shallow';
import TestRenderer from 'react-test-renderer';
import Header from './';
import { UniversalNav } from './components/UniversalNav';
import NavLinks from './components/NavLinks';
describe('<Header />', () => {
describe('<UniversalNav />', () => {
it('renders to the DOM', () => {
const shallow = new ShallowRenderer();
shallow.render(<Header />);
shallow.render(<UniversalNav {...UniversalNavProps} />);
const result = shallow.getRenderOutput();
expect(result).toBeTruthy();
});
});
describe('<NavLinks />', () => {
const root = TestRenderer.create(<NavLinks />).root;
const aTags = root.findAllByType('a');
@ -25,17 +23,23 @@ describe('<NavLinks />', () => {
return acc;
}, []);
const expectedLinks = ['/', '/portfolio'];
const expectedLinks = ['/learn', '/', '/portfolio'];
it('renders to the DOM', () => {
expect(root).toBeTruthy();
});
it('has 3 a tags', () => {
it('has 3 links', () => {
expect(aTags.length === 3).toBeTruthy();
});
it('has link to portfolio', () => {
it('has links to learn, main, and portfolio', () => {
// checks if all links in expected links exist in links
expect(expectedLinks.every(elem => links.indexOf(elem) > -1)).toBeTruthy();
});
});
const UniversalNavProps = {
displayMenu: false,
menuButtonRef: {},
toggleDisplayMenu: function() {}
};