diff --git a/package.json b/package.json
index 87d959a..2513e58 100644
--- a/package.json
+++ b/package.json
@@ -7,6 +7,7 @@
"license": "PRIVATE",
"private": true,
"dependencies": {
+ "axios": "^0.18.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"design-system": "git://github.com/Wikia/design-system.git#XW-4947",
"lodash.get": "^4.4.2",
@@ -36,6 +37,7 @@
"watch:notify": "concurrently --names \"SERVER,TESTS\" --prefix \"{time}|{name}\" \"yarn build:watch\" \"yarn test:watch:notify\""
},
"devDependencies": {
+ "axios-mock-adapter": "^1.15.0",
"babel-core": "^6.26.0",
"babel-jest": "^22.4.1",
"babel-loader": "^7.1.3",
diff --git a/src/components/GlobalFooter/__snapshots__/index.spec.js.snap b/src/components/GlobalFooter/__snapshots__/index.spec.js.snap
new file mode 100644
index 0000000..11e11cb
--- /dev/null
+++ b/src/components/GlobalFooter/__snapshots__/index.spec.js.snap
@@ -0,0 +1,7 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`GlobalFooter should render correctly with default data 1`] = `
+
+ NOT IMPLEMENTED
+
+`;
diff --git a/src/components/GlobalFooter/index.spec.js b/src/components/GlobalFooter/index.spec.js
new file mode 100644
index 0000000..fd259bd
--- /dev/null
+++ b/src/components/GlobalFooter/index.spec.js
@@ -0,0 +1,13 @@
+import React from 'react';
+import renderer from 'react-test-renderer';
+import {shallow} from 'enzyme';
+import sinon from 'sinon';
+
+import GlobalFooter from './index';
+
+test('GlobalFooter should render correctly with default data', () => {
+ const component = renderer.create(
+
+ );
+ expect(component.toJSON()).toMatchSnapshot();
+});
diff --git a/src/components/GlobalNavigation/README.md b/src/components/GlobalNavigation/README.md
index 19e52b9..b0ae40b 100644
--- a/src/components/GlobalNavigation/README.md
+++ b/src/components/GlobalNavigation/README.md
@@ -1,3 +1,14 @@
+User:
```js
-
+ Promise.resolve({data: require('./mockedData').user})}/>
+```
+
+Anon:
+```js
+ Promise.resolve({data: require('./mockedData').anon})}/>
+```
+
+Anon with Partner Slot:
+```js
+ Promise.resolve({data: require('./mockedData').anonPartner})}/>
```
diff --git a/src/components/GlobalNavigation/__snapshots__/index.spec.js.snap b/src/components/GlobalNavigation/__snapshots__/index.spec.js.snap
new file mode 100644
index 0000000..c8aabc2
--- /dev/null
+++ b/src/components/GlobalNavigation/__snapshots__/index.spec.js.snap
@@ -0,0 +1,29 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`GlobalNavigation should render correctly with mocked anon 1`] = `
+
+`;
+
+exports[`GlobalNavigation should render correctly with mocked partner slot 1`] = `
+
+`;
+
+exports[`GlobalNavigation should render correctly with mocked user 1`] = `
+
+`;
+
+exports[`GlobalNavigation should work with axios 1`] = `
+
+`;
diff --git a/src/components/GlobalNavigation/components/Link.js b/src/components/GlobalNavigation/components/Link.js
index fb0712e..c1c7cd0 100644
--- a/src/components/GlobalNavigation/components/Link.js
+++ b/src/components/GlobalNavigation/components/Link.js
@@ -171,7 +171,11 @@ const Link = ({link, ...props}) => {
};
Link.propTypes = {
- link: linkType.isRequired,
+ link: linkType,
+};
+
+Link.defaultProps = {
+ link: null,
};
export default Link;
diff --git a/src/components/GlobalNavigation/components/Link.spec.js b/src/components/GlobalNavigation/components/Link.spec.js
new file mode 100644
index 0000000..be65104
--- /dev/null
+++ b/src/components/GlobalNavigation/components/Link.spec.js
@@ -0,0 +1,153 @@
+import React from 'react';
+import renderer from 'react-test-renderer';
+import {shallow} from 'enzyme';
+import sinon from 'sinon';
+
+import Link from './Link';
+
+const emptyLink = {
+ type: '',
+ title: 'title',
+ tracking_label: 'tracking_label',
+};
+
+/* eslint-disable no-alert */
+
+test('Link should\'t render empty', () => {
+ const component = renderer.create(
+
+ );
+ expect(component.toJSON()).toBe(null);
+});
+
+test('Link should\'t render unknown type', () => {
+ // mock console.error
+ const consoleSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
+
+ const unknownLink = {...emptyLink, type: '?'};
+ const component = renderer.create(
+
+ );
+ expect(component.toJSON()).toBe(null);
+ // check console.error
+ expect(console.error).toHaveBeenCalled(); // eslint-disable-line no-console
+ expect(consoleSpy.mock.calls[0][0]).toContain('Unknown Link type:');
+
+ // restore global console
+ consoleSpy.mockRestore();
+});
+
+test('Link should render type link-nav', () => {
+ const link = {
+ ...emptyLink,
+ type: 'link-nav',
+ href: 'http://example.com',
+ };
+ const component = renderer.create(
+
+ );
+ expect(component.toJSON()).toMatchSnapshot();
+});
+
+test('Link should render type link-text', () => {
+ const link = {
+ ...emptyLink,
+ type: 'link-text',
+ href: 'http://example.com',
+ };
+ const component = renderer.create(
+
+ );
+ expect(component.toJSON()).toMatchSnapshot();
+});
+
+test('Link should render type link-button', () => {
+ const link = {
+ ...emptyLink,
+ type: 'link-button',
+ href: 'http://example.com',
+ };
+ const component = renderer.create(
+
+ );
+ expect(component.toJSON()).toMatchSnapshot();
+});
+
+test('Link should render type link-group', () => {
+ const link = {
+ ...emptyLink,
+ type: 'link-group',
+ title: 'group',
+ items: [
+ {...emptyLink, type: 'link-text', href: 'http://example.com', tracking_label: '1'},
+ {...emptyLink, type: 'link-button', href: 'http://example.com', tracking_label: '2'},
+ ],
+ };
+ const component = renderer.create(
+
+ );
+ expect(component.toJSON()).toMatchSnapshot();
+});
+
+test('Link should render type link-partner-slot', () => {
+ const link = {
+ ...emptyLink,
+ type: 'link-partner-slot',
+ href: 'http://partner.com',
+ image: 'http://partner.com/image.jpg',
+ };
+ const component = renderer.create(
+
+ );
+ expect(component.toJSON()).toMatchSnapshot();
+});
+
+test('Link should render type link-logo', () => {
+ const link = {
+ ...emptyLink,
+ type: 'link-logo',
+ href: 'http://example.com',
+ edition: '',
+ };
+ const component = renderer.create(
+
+ );
+ expect(component.toJSON()).toMatchSnapshot();
+});
+
+test('Link should render type link-logout', () => {
+ const link = {
+ ...emptyLink,
+ type: 'link-logout',
+ href: 'http://example.com',
+ };
+ const component = renderer.create(
+
+ );
+ expect(component.toJSON()).toMatchSnapshot();
+});
+
+test('Link should render type link-full-button', () => {
+ const link = {
+ ...emptyLink,
+ type: 'link-full-button',
+ href: 'http://example.com',
+ };
+ const component = renderer.create(
+
+ );
+ expect(component.toJSON()).toMatchSnapshot();
+});
+
+test('Link should render type link-full-button-secondary with caption', () => {
+ const link = {
+ ...emptyLink,
+ type: 'link-full-button-secondary',
+ href: 'http://example.com',
+ caption: 'A caption',
+ };
+ const component = renderer.create(
+
+ );
+ expect(component.toJSON()).toMatchSnapshot();
+});
diff --git a/src/components/GlobalNavigation/components/Search.js b/src/components/GlobalNavigation/components/Search.js
index 31ded4f..3d8156c 100644
--- a/src/components/GlobalNavigation/components/Search.js
+++ b/src/components/GlobalNavigation/components/Search.js
@@ -8,6 +8,7 @@ class Search extends React.Component {
this.searchFocus = this.searchFocus.bind(this);
this.searchBlur = this.searchBlur.bind(this);
this.searchChange = this.searchChange.bind(this);
+ this.resetSearchInput = this.resetSearchInput.bind(this);
this.searchInputRef = React.createRef();
}
@@ -16,23 +17,29 @@ class Search extends React.Component {
searchIsEmpty: true,
};
- searchChange() {
- const searchIsEmpty = this.searchInputRef.current.value.length === 0;
+ searchChange(event) {
+ const value = event.target.value;
+ const searchIsEmpty = value.length === 0;
this.setState({searchIsEmpty});
}
+ resetSearchInput() {
+ this.setState({searchIsEmpty: true});
+ this.searchInputRef.current.value = '';
+ }
+
searchFocus() {
- this.setState({searchIsFocused: true, searchIsEmpty: true});
+ this.resetSearchInput();
+ this.setState({searchIsFocused: true});
this.props.onStateChange(true);
- this.searchInputRef.current.value = '';
this.searchInputRef.current.focus();
}
searchBlur() {
- this.setState({searchIsFocused: false, searchIsEmpty: true});
+ this.resetSearchInput();
+ this.setState({searchIsFocused: false});
this.props.onStateChange(false);
- this.searchInputRef.current.value = '';
this.searchInputRef.current.blur();
}
diff --git a/src/components/GlobalNavigation/components/Search.spec.js b/src/components/GlobalNavigation/components/Search.spec.js
new file mode 100644
index 0000000..65a0aa3
--- /dev/null
+++ b/src/components/GlobalNavigation/components/Search.spec.js
@@ -0,0 +1,50 @@
+import React from 'react';
+import renderer from 'react-test-renderer';
+import {shallow, mount} from 'enzyme';
+import sinon from 'sinon';
+
+import Search from './Search';
+
+const search = {
+ url: 'http://fandom.wikia.com',
+ param: 's',
+ label: 'Search',
+ placeholder_active: 'Placeholder Active',
+ placeholder_inactive: 'Placeholder Inactive',
+ tracking_label: 'search',
+};
+
+test('Search should render correctly', () => {
+ const component = renderer.create(
+ null} />
+ );
+ expect(component.toJSON()).toMatchSnapshot();
+});
+
+test('Click on the search should invoke onStateChange', () => {
+ const mockedCallback = sinon.spy();
+ const wrapper = mount(
+
+ );
+
+ expect(wrapper.state().searchIsFocused).toBe(false);
+ wrapper.find('.wds-global-navigation__search-input-wrapper > input').simulate('focus');
+ expect(wrapper.state().searchIsFocused).toBe(true);
+ wrapper.find('.wds-global-navigation__search-input-wrapper > input').simulate('blur');
+ expect(wrapper.state().searchIsFocused).toBe(false);
+
+ expect(mockedCallback.callCount).toBe(2);
+});
+
+test('Empty state is handled properly', () => {
+ const wrapper = mount(
+ null} />
+ );
+
+ expect(wrapper.state().searchIsEmpty).toBe(true);
+ wrapper.instance().searchChange({target: {value: 'value'}});
+ expect(wrapper.state('searchIsEmpty')).toBe(false);
+});
+
+test('Focus change is handled properly', () => {
+});
diff --git a/src/components/GlobalNavigation/components/User.spec.js b/src/components/GlobalNavigation/components/User.spec.js
new file mode 100644
index 0000000..52d7892
--- /dev/null
+++ b/src/components/GlobalNavigation/components/User.spec.js
@@ -0,0 +1,45 @@
+import React from 'react';
+import renderer from 'react-test-renderer';
+import {shallow} from 'enzyme';
+import sinon from 'sinon';
+
+import User from './User';
+
+test('User shouldn\'t render with null', () => {
+ const component = renderer.create(
+
+ );
+ expect(component.toJSON()).toBe(null);
+});
+
+test('User should render correctly with data', () => {
+ const user = {
+ avatar: 'https://static.wikia.nocookie.net/2536a38e-ab79-4d85-a5a0-16428e2582e8/scale-to-width-down/50',
+ username: 'User name',
+ tracking_label: 'account',
+ items: [
+ {
+ type: 'link-text',
+ title: 'View wiki profile',
+ href: 'http://community.wikia.com/wiki/User:User_name',
+ tracking_label: 'account.profile-wiki',
+ },
+ {
+ type: 'link-text',
+ title: 'View author profile',
+ href: 'http://fandom.wikia.com/u/User_name',
+ tracking_label: 'account.profile',
+ },
+ {
+ type: 'link-logout',
+ title: 'Sign-out',
+ href: 'https://www.sandbox-content.wikia.com/signout?redirect=',
+ tracking_label: 'account.sign-out',
+ },
+ ],
+ };
+ const component = renderer.create(
+
+ );
+ expect(component.toJSON()).toMatchSnapshot();
+});
diff --git a/src/components/GlobalNavigation/components/UserAnon.spec.js b/src/components/GlobalNavigation/components/UserAnon.spec.js
new file mode 100644
index 0000000..57d2741
--- /dev/null
+++ b/src/components/GlobalNavigation/components/UserAnon.spec.js
@@ -0,0 +1,35 @@
+import React from 'react';
+import renderer from 'react-test-renderer';
+import {shallow} from 'enzyme';
+import sinon from 'sinon';
+
+import UserAnon from './UserAnon';
+
+test('UserAnon shouldn\'t render with null', () => {
+ const component = renderer.create(
+
+ );
+ expect(component.toJSON()).toBe(null);
+});
+
+test('UserAnon should render correctly with data', () => {
+ const anonLinks = [
+ {
+ type: 'link-full-button',
+ href: 'https://www.sandbox-content.wikia.com/signin?redirect=',
+ title: 'Sign-in',
+ tracking_label: 'account.sign-in',
+ },
+ {
+ type: 'link-full-button-secondary',
+ href: 'https://www.sandbox-content.wikia.com/register?redirect=',
+ title: 'Register',
+ tracking_label: 'account.register',
+ caption: 'Don\'t have an account?',
+ },
+ ];
+ const component = renderer.create(
+
+ );
+ expect(component.toJSON()).toMatchSnapshot();
+});
diff --git a/src/components/GlobalNavigation/components/__snapshots__/Link.spec.js.snap b/src/components/GlobalNavigation/components/__snapshots__/Link.spec.js.snap
new file mode 100644
index 0000000..3f54d87
--- /dev/null
+++ b/src/components/GlobalNavigation/components/__snapshots__/Link.spec.js.snap
@@ -0,0 +1,166 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Link should render type link-button 1`] = `
+
+ title
+
+`;
+
+exports[`Link should render type link-full-button 1`] = `
+
+ title
+
+`;
+
+exports[`Link should render type link-full-button-secondary with caption 1`] = `
+Array [
+
+ A caption
+
,
+
+ title
+ ,
+]
+`;
+
+exports[`Link should render type link-group 1`] = `
+
+
+
+ group
+
+
+
+
+
+`;
+
+exports[`Link should render type link-logo 1`] = `
+
+
+
+
+
+
+`;
+
+exports[`Link should render type link-logout 1`] = `
+
+`;
+
+exports[`Link should render type link-nav 1`] = `
+
+ title
+
+`;
+
+exports[`Link should render type link-partner-slot 1`] = `
+
+`;
+
+exports[`Link should render type link-text 1`] = `
+
+ title
+
+`;
diff --git a/src/components/GlobalNavigation/components/__snapshots__/Search.spec.js.snap b/src/components/GlobalNavigation/components/__snapshots__/Search.spec.js.snap
new file mode 100644
index 0000000..66dbbf7
--- /dev/null
+++ b/src/components/GlobalNavigation/components/__snapshots__/Search.spec.js.snap
@@ -0,0 +1,80 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Search should render correctly 1`] = `
+
+`;
diff --git a/src/components/GlobalNavigation/components/__snapshots__/User.spec.js.snap b/src/components/GlobalNavigation/components/__snapshots__/User.spec.js.snap
new file mode 100644
index 0000000..4fbd8db
--- /dev/null
+++ b/src/components/GlobalNavigation/components/__snapshots__/User.spec.js.snap
@@ -0,0 +1,75 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`User should render correctly with data 1`] = `
+
+
+
+

+
+
+
+
+
+`;
diff --git a/src/components/GlobalNavigation/components/__snapshots__/UserAnon.spec.js.snap b/src/components/GlobalNavigation/components/__snapshots__/UserAnon.spec.js.snap
new file mode 100644
index 0000000..f15de8c
--- /dev/null
+++ b/src/components/GlobalNavigation/components/__snapshots__/UserAnon.spec.js.snap
@@ -0,0 +1,64 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`UserAnon should render correctly with data 1`] = `
+
+`;
diff --git a/src/components/GlobalNavigation/index.js b/src/components/GlobalNavigation/index.js
index de28bea..e9daf78 100644
--- a/src/components/GlobalNavigation/index.js
+++ b/src/components/GlobalNavigation/index.js
@@ -7,8 +7,6 @@ import Search from './components/Search';
import User from './components/User';
import UserAnon from './components/UserAnon';
-import mockedData from './mockedData';
-
import './styles.scss';
class GlobalNavigation extends React.Component {
@@ -24,20 +22,11 @@ class GlobalNavigation extends React.Component {
};
componentDidMount() {
- this._apiRequest = null;
- setTimeout(() => this.setState({navigationData: mockedData}), 1);
- // this._apiRequest = this.props.api().then(
- // (response) => {
- // this._apiRequest = null;
- // this.setState({navigationData: response});
- // }
- // );
- }
-
- componentWillUnmount() {
- if (this._apiRequest) {
- this._apiRequest.cancel();
- }
+ this.props.api().then(
+ (response) => {
+ this.setState({navigationData: response.data});
+ }
+ );
}
onSearchStateChange(searchIsFocused) {
diff --git a/src/components/GlobalNavigation/index.spec.js b/src/components/GlobalNavigation/index.spec.js
new file mode 100644
index 0000000..4da5654
--- /dev/null
+++ b/src/components/GlobalNavigation/index.spec.js
@@ -0,0 +1,191 @@
+import React from 'react';
+import renderer from 'react-test-renderer';
+import {shallow, mount} from 'enzyme';
+import sinon from 'sinon';
+import axios from 'axios';
+import MockAdapter from 'axios-mock-adapter';
+
+import GlobalNavigation from './index';
+
+const mockedData = {
+ logo: {
+ type: 'link-logo',
+ title: 'FANDOM',
+ href: 'http://fandom.wikia.com/',
+ tracking_label: 'logo',
+ edition: 'UK',
+ },
+ search: {
+ url: 'http://fandom.wikia.com',
+ param: 's',
+ label: 'Search',
+ placeholder_active: 'Placeholder Active',
+ placeholder_inactive: 'Placeholder Inactive',
+ tracking_label: 'search',
+ },
+ create_wiki: {
+ type: 'link-button',
+ title: 'Create a wiki',
+ href: 'http://fandom.wikia.com/',
+ tracking_label: 'start-a-wiki',
+ },
+ main_navigation: [
+ {
+ type: 'link-nav',
+ title: 'Games',
+ href: 'http://fandom.wikia.com/topic/games',
+ tracking_label: 'link.games',
+ },
+ {
+ type: 'link-nav',
+ title: 'Movies',
+ href: 'http://fandom.wikia.com/topic/games',
+ tracking_label: 'link.movies',
+ },
+ {
+ type: 'link-nav',
+ title: 'TV',
+ href: 'http://fandom.wikia.com/topic/games',
+ tracking_label: 'link.tv',
+ },
+ {
+ type: 'link-nav',
+ title: 'Video',
+ href: 'http://fandom.wikia.com/video',
+ tracking_label: 'link.video',
+ },
+ {
+ type: 'link-group',
+ title: 'Wikis',
+ items: [
+ {
+ type: 'link-text',
+ title: 'Explore',
+ href: 'http://fandom.wikia.com/explore',
+ tracking_label: 'link.explore',
+ },
+ {
+ type: 'link-text',
+ title: 'Community',
+ href: 'http://de.community.sandbox-content.wikia.com/wiki/Community_Deutschland',
+ tracking_label: 'link.community-central',
+ },
+ {
+ type: 'link-text',
+ title: 'Fandom University',
+ href: 'http://fandom.wikia.com/wiki/Fandom_University',
+ tracking_label: 'link.fandom-university',
+ },
+ {
+ type: 'link-button',
+ title: 'Create a wiki',
+ href: 'http://fandom.wikia.com/',
+ tracking_label: 'start-a-wiki',
+ },
+ ],
+ },
+ ],
+};
+
+test('GlobalNavigation should render correctly with mocked user', () => {
+ const mockedUserData = {
+ ...mockedData,
+ user: {
+ avatar: 'https://static.wikia.nocookie.net/2536a38e-ab79-4d85-a5a0-16428e2582e8/scale-to-width-down/50',
+ username: 'User name',
+ tracking_label: 'account',
+ items: [
+ {
+ type: 'link-text',
+ title: 'View wiki profile',
+ href: 'http://community.wikia.com/wiki/User:User_name',
+ tracking_label: 'account.profile-wiki',
+ },
+ {
+ type: 'link-text',
+ title: 'View author profile',
+ href: 'http://fandom.wikia.com/u/User_name',
+ tracking_label: 'account.profile',
+ },
+ {
+ type: 'link-logout',
+ title: 'Sign-out',
+ href: 'https://www.sandbox-content.wikia.com/signout?redirect=',
+ tracking_label: 'account.sign-out',
+ },
+ ],
+ },
+ };
+
+ const wrapper = mount(
+ ({data: mockedUserData})} />
+ );
+ expect(wrapper).toMatchSnapshot();
+});
+
+test('GlobalNavigation should render correctly with mocked anon', () => {
+ const mockedAnonData = {
+ ...mockedData,
+ anon: [
+ {
+ type: 'link-full-button',
+ href: 'https://www.sandbox-content.wikia.com/signin?redirect=',
+ title: 'Sign-in',
+ tracking_label: 'account.sign-in',
+ },
+ {
+ type: 'link-full-button-secondary',
+ href: 'https://www.sandbox-content.wikia.com/register?redirect=',
+ title: 'Register',
+ tracking_label: 'account.register',
+ caption: 'Don\'t have an account?',
+ },
+ ],
+ };
+
+ const wrapper = mount(
+ ({data: mockedAnonData})} />
+ );
+ expect(wrapper).toMatchSnapshot();
+});
+
+test('GlobalNavigation should render correctly with mocked partner slot', () => {
+ const mockedPartnerData = {
+ ...mockedData,
+ partner_slot: {
+ type: 'link-partner-slot',
+ href: 'http://www.entertainweb.de/',
+ image: 'https://services.wikia.com/static-assets/image/5588e692-fae8-4dc3-8db6-5f62e37fed47',
+ title: 'entertainweb',
+ tracking_label: 'entertainweb',
+ },
+ };
+
+ const wrapper = mount(
+ ({data: mockedPartnerData})} />
+ );
+ expect(wrapper).toMatchSnapshot();
+});
+
+test('GlobalNavigation should work with axios', () => {
+ const mock = new MockAdapter(axios);
+ mock.onGet('/data').reply(200, mockedData);
+
+ const api = () => axios.get('/data');
+
+ const wrapper = mount(
+
+ );
+ expect(wrapper).toMatchSnapshot();
+});
+
+test('GlobalNavigation should trigger state change based on the Search trigger', () => {
+ const wrapper = mount(
+ ({data: mockedData})} />
+ );
+
+ const instance = wrapper.instance();
+
+ instance.onSearchStateChange(true);
+ expect(wrapper.state().searchIsFocused).toBe(true);
+});
diff --git a/src/components/GlobalNavigation/linkType.js b/src/components/GlobalNavigation/linkType.js
index 5b0e8dc..ee574ce 100644
--- a/src/components/GlobalNavigation/linkType.js
+++ b/src/components/GlobalNavigation/linkType.js
@@ -3,9 +3,13 @@ import PropTypes from 'prop-types';
const linkType = PropTypes.shape({
type: PropTypes.string.isRequired,
title: PropTypes.string.isRequired,
+ // optional fields
+ caption: PropTypes.string,
+ edition: PropTypes.string,
href: PropTypes.string,
+ image: PropTypes.string,
+ items: PropTypes.arrayOf(PropTypes.shape()),
tracking_label: PropTypes.string,
- edition: PropTypes.string,
});
export default linkType;
diff --git a/src/components/GlobalNavigation/mockedData.js b/src/components/GlobalNavigation/mockedData.js
index 552371c..5202547 100644
--- a/src/components/GlobalNavigation/mockedData.js
+++ b/src/components/GlobalNavigation/mockedData.js
@@ -1,4 +1,4 @@
-export default {
+const defaultData = {
logo: {
type: 'link-logo',
title: 'FANDOM',
@@ -76,7 +76,30 @@ export default {
],
},
],
- __user: {
+};
+
+const anon = {
+ ...defaultData,
+ anon: [
+ {
+ type: 'link-full-button',
+ href: 'https://www.sandbox-content.wikia.com/signin?redirect=',
+ title: 'Sign-in',
+ tracking_label: 'account.sign-in',
+ },
+ {
+ type: 'link-full-button-secondary',
+ href: 'https://www.sandbox-content.wikia.com/register?redirect=',
+ title: 'Register',
+ tracking_label: 'account.register',
+ caption: 'Don\'t have an account?',
+ },
+ ],
+};
+
+const user = {
+ ...defaultData,
+ user: {
avatar: 'https://static.wikia.nocookie.net/2536a38e-ab79-4d85-a5a0-16428e2582e8/scale-to-width-down/50',
username: 'User name',
tracking_label: 'account',
@@ -101,21 +124,10 @@ export default {
},
],
},
- anon: [
- {
- type: 'link-full-button',
- href: 'https://www.sandbox-content.wikia.com/signin?redirect=',
- title: 'Sign-in',
- tracking_label: 'account.sign-in',
- },
- {
- type: 'link-full-button-secondary',
- href: 'https://www.sandbox-content.wikia.com/register?redirect=',
- title: 'Register',
- tracking_label: 'account.register',
- caption: 'Don\'t have an account?',
- },
- ],
+};
+
+const anonPartner = {
+ ...anon,
partner_slot: {
type: 'link-partner-slot',
href: 'http://www.entertainweb.de/',
@@ -124,3 +136,9 @@ export default {
tracking_label: 'entertainweb',
},
};
+
+module.exports = {
+ anon,
+ user,
+ anonPartner,
+};
diff --git a/yarn.lock b/yarn.lock
index dab33b7..6a79806 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -533,6 +533,19 @@ aws4@^1.2.1, aws4@^1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e"
+axios-mock-adapter@^1.15.0:
+ version "1.15.0"
+ resolved "https://registry.yarnpkg.com/axios-mock-adapter/-/axios-mock-adapter-1.15.0.tgz#fbc06825d8302c95c3334d21023bba996255d45d"
+ dependencies:
+ deep-equal "^1.0.1"
+
+axios@^0.18.0:
+ version "0.18.0"
+ resolved "https://registry.yarnpkg.com/axios/-/axios-0.18.0.tgz#32d53e4851efdc0a11993b6cd000789d70c05102"
+ dependencies:
+ follow-redirects "^1.3.0"
+ is-buffer "^1.1.5"
+
axobject-query@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-0.1.0.tgz#62f59dbc59c9f9242759ca349960e7a2fe3c36c0"
@@ -3645,6 +3658,12 @@ flush-write-stream@^1.0.0:
inherits "^2.0.1"
readable-stream "^2.0.4"
+follow-redirects@^1.3.0:
+ version "1.5.0"
+ resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.0.tgz#234f49cf770b7f35b40e790f636ceba0c3a0ab77"
+ dependencies:
+ debug "^3.1.0"
+
for-in@^0.1.3:
version "0.1.8"
resolved "https://registry.yarnpkg.com/for-in/-/for-in-0.1.8.tgz#d8773908e31256109952b1fdb9b3fa867d2775e1"