Skip to content

Commit

Permalink
Neolink redesign header (#77)
Browse files Browse the repository at this point in the history
* Initial commit. Changed header structure and general styling.

* Header WIP: Network Navigation WIP & prettier eslint setup

* Header WIP - Added custom network switcher dropdown

* Added event listener to close network menu when clicked outside of the menu window

* Add styled indicator for custom networks

* Main navigation WIP

* Added icons and styling to main navigation

* Add login state to header

* Add event listener to remove dropdown on window click

* Header finished. Tests WIP

* Get SVGs working in tests

* All tests working

* Fix eslint spacing

* Change ID selector to classbased selector

* Remove merge conflict

* Add SVG naming convention

* Implement development routes

* rewrite test to use simple class selector

* Remove console.log in test

* Add remove event listener to main nav

* Header refactor

* Changed app logic to fit with header flow. Added login to home screen

* Login redirects to home

* Reintroduce showmenu to header

* Remove required from login history proptype

* eslint fix
  • Loading branch information
FredrikOseberg authored and slipo committed Mar 14, 2018
1 parent a643c62 commit 7edb9ec
Show file tree
Hide file tree
Showing 35 changed files with 1,905 additions and 385 deletions.
58 changes: 28 additions & 30 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
{
"parser": "babel-eslint",
"plugins": [
"json",
"react"
],
"env": {
"es6": true,
"jest": true
},
"globals": {
"chrome": true,
"clearInterval": true,
"clearTimeout": true,
"console": true,
"document": true,
"expect": true,
"Promise": true,
"setInterval": true,
"setTimeout": true,
"window": true
},
"extends": ["standard", "standard-react"],
"rules": {
"comma-dangle": ["error", "always-multiline"],
"object-curly-spacing": ["error", "always"],
"no-var": "error",
"quotes": ["error", "single"],
"react/jsx-curly-spacing": [2, {"when": "always", "allowMultiline": false}],
"space-before-function-paren": 0
}
"parser": "babel-eslint",
"plugins": ["json", "react", "prettier"],
"env": {
"es6": true,
"jest": true
},
"globals": {
"chrome": true,
"clearInterval": true,
"clearTimeout": true,
"console": true,
"document": true,
"expect": true,
"Promise": true,
"setInterval": true,
"setTimeout": true,
"window": true
},
"extends": ["standard", "standard-react"],
"rules": {
"comma-dangle": ["error", "always-multiline"],
"object-curly-spacing": ["error", "always"],
"no-var": "error",
"quotes": ["error", "single"],
"react/jsx-curly-spacing": [2, { "when": "always", "allowMultiline": false }],
"space-before-function-paren": 0,
"experimentalDecorators": 0
}
}
1 change: 1 addition & 0 deletions __mocks__/fileMock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = 'test-file-stub'
13 changes: 7 additions & 6 deletions __tests__/components/NetworkSwitcher.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const setup = () => {
}

describe('NetworkSwitch', () => {
test('renders without crashing', (done) => {
test('renders without crashing', done => {
const { wrapper } = setup()
expect(wrapper).toMatchSnapshot()
done()
Expand All @@ -31,21 +31,22 @@ describe('NetworkSwitch', () => {
test('correctly renders MainNet initially', () => {
const { wrapper } = setup()

const networkSelectorElement = wrapper.find('select').getElement()
const networkSelectorElement = wrapper.find('button[data-value="MainNet"]')

expect(networkSelectorElement.props.defaultValue).toEqual('MainNet')
expect(networkSelectorElement.children().length).toBe(3)
})

test('switches to the correct network when chosen from the dropdown', async () => {
const { wrapper } = setup()

const instance = wrapper.instance()
const networkSelector = wrapper.find('select')
networkSelector.simulate('change', { target: { value: 'TestNet' } })
const networkSelector = wrapper.find('.networkNavigationDropdown')

networkSelector.simulate('click', { target: { dataset: { value: 'TestNet' } } })

expect(instance.props.setNetwork).toHaveBeenCalledWith('TestNet')

networkSelector.simulate('change', { target: { value: 'MainNet' } })
networkSelector.simulate('click', { target: { dataset: { value: 'MainNet' } } })

expect(instance.props.setNetwork).toHaveBeenCalledWith('MainNet')
})
Expand Down
Loading

0 comments on commit 7edb9ec

Please sign in to comment.