Restore logo (#218)

* move tower logo svg into component

* switch to new logo in header & login screen
This commit is contained in:
Keith Grant
2019-05-23 13:47:41 -04:00
committed by GitHub
parent cc2869d0c2
commit 189e12f8b3
5 changed files with 140 additions and 125 deletions

View File

@@ -1,15 +1,14 @@
import React from 'react';
import { createMemoryHistory } from 'history';
import { mountWithContexts } from '../enzymeHelpers';
import TowerLogo from '../../src/components/TowerLogo';
let logoWrapper;
let towerLogoElem;
let brandElem;
let svgElem;
const findChildren = () => {
towerLogoElem = logoWrapper.find('TowerLogo');
brandElem = logoWrapper.find('Brand');
svgElem = logoWrapper.find('svg');
};
describe('<TowerLogo />', () => {
@@ -20,39 +19,6 @@ describe('<TowerLogo />', () => {
findChildren();
expect(logoWrapper.length).toBe(1);
expect(towerLogoElem.length).toBe(1);
expect(brandElem.length).toBe(1);
});
test('adds navigation to route history on click', () => {
const history = createMemoryHistory({
initialEntries: ['/organizations/1/teams'],
});
logoWrapper = mountWithContexts(
<TowerLogo linkTo="/" />, { context: { router: { history } } }
);
findChildren();
expect(towerLogoElem.props().history.length).toBe(1);
logoWrapper.simulate('click');
expect(towerLogoElem.props().history.length).toBe(2);
});
test('handles mouse over and out state.hover changes', () => {
logoWrapper = mountWithContexts(
<TowerLogo />
);
findChildren();
findChildren();
expect(brandElem.props().src).toBe('tower-logo-header.svg');
brandElem.props().onMouseOver();
expect(towerLogoElem.state().hover).toBe(true);
logoWrapper.update();
findChildren();
expect(brandElem.props().src).toBe('tower-logo-header-hover.svg');
brandElem.props().onMouseOut();
expect(towerLogoElem.state().hover).toBe(false);
logoWrapper.update();
findChildren();
expect(brandElem.props().src).toBe('tower-logo-header.svg');
expect(svgElem.length).toBe(1);
});
});