Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fabo common tests #262

Merged
merged 44 commits into from
Dec 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
8384d0b
Merge branch 'develop' into fabo/119-common-tests
faboweb Dec 15, 2017
51b4cfb
test page 404
faboweb Dec 18, 2017
d5932d8
test toggle btn
faboweb Dec 18, 2017
18bbb3b
extend nodemock
faboweb Dec 18, 2017
2a6c6be
extracted test setup for vuex tests
faboweb Dec 18, 2017
c16c606
test NiUserPane
faboweb Dec 18, 2017
7a1852c
fail on console.error
faboweb Dec 19, 2017
df1fcf8
test NiLiCopy
faboweb Dec 20, 2017
8627725
test nilistitem
faboweb Dec 20, 2017
62e5167
Merge remote-tracking branch 'origin/develop' into fabo/119-common-tests
faboweb Dec 20, 2017
6157fec
updated 404 snapshot
faboweb Dec 20, 2017
6a22161
test for NiModal
faboweb Dec 20, 2017
46fe7fb
test NiModalHelp
faboweb Dec 20, 2017
8bc852d
test for NiModalSearch
faboweb Dec 20, 2017
2a51fc2
test NiPageFooter
faboweb Dec 20, 2017
e9cae6f
test NiPageHeader
faboweb Dec 20, 2017
c2691f4
test NiPage
faboweb Dec 20, 2017
eadf6e9
linted
faboweb Dec 20, 2017
b22b6db
Merge branch 'develop' into fabo/255-fail-console-error
nylira Dec 21, 2017
b53a7fb
resolve test issue
nylira Dec 21, 2017
88ce917
fix lint
nylira Dec 21, 2017
cb2fc18
capitalization
nylira Dec 21, 2017
b8decc9
removed console.error override
faboweb Dec 21, 2017
6e22cf7
extracted test setup for vuex tests
faboweb Dec 18, 2017
abb3126
extend nodemock
faboweb Dec 18, 2017
dc20361
test NiPage
faboweb Dec 20, 2017
b239c0f
use same eslintrc for test helpers
faboweb Dec 21, 2017
002aef7
fail on uncaught
faboweb Dec 21, 2017
a279ba0
fix wallet commit unavailable
faboweb Dec 21, 2017
7fccce0
improve vuex test setup
faboweb Dec 21, 2017
ceba7e2
improve tests
faboweb Dec 21, 2017
0bb36c6
merged
faboweb Dec 21, 2017
a9529db
linted
faboweb Dec 21, 2017
f70de64
update circleci node version
faboweb Dec 21, 2017
070c254
remove not needed frame buffer
faboweb Dec 21, 2017
6909d9b
limit jest workers
faboweb Dec 21, 2017
c6f3fb3
only add unhandledRejection handler once
faboweb Dec 21, 2017
36f4555
do not attach listeners to process in tests
faboweb Dec 21, 2017
f96fbdb
fixed unhandledRejection handler still being added
faboweb Dec 21, 2017
bf97d8f
extracted test setup to only be called once per suite
faboweb Dec 21, 2017
f640d71
removing worker limit for jest
faboweb Dec 21, 2017
f6be1c8
Merge branch 'fabo/255-fail-console-error' into local-common-test
faboweb Dec 21, 2017
a8bc7ad
fixed tests
faboweb Dec 21, 2017
badccd7
Merge branch 'local-common-test' into fabo/119-common-tests
faboweb Dec 21, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:8.0.0-browsers
- image: circleci/node:8.9.3-browsers

working_directory: ~/repo

Expand Down Expand Up @@ -42,6 +42,5 @@ jobs:
key: v1-dependencies-app-{{ checksum "app/package.json" }}

- run: yarn lint
# - run: npm run pack
- run: xvfb-run -e /dev/stdout -a npm run test
- run: yarn run test
- run: codeclimate-test-reporter < test/unit/coverage/lcov.info
20 changes: 11 additions & 9 deletions app/src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,15 +295,17 @@ function setupLogging (root) {
}
}

process.on('exit', shutdown)
process.on('uncaughtException', function (err) {
logError('[Uncaught Exception]', err)
setTimeout(async () => {
await shutdown()
process.exit(1)
}, 200)
setTimeout(shutdown, 200)
})
if (!TEST) {
process.on('exit', shutdown)
process.on('uncaughtException', function (err) {
logError('[Uncaught Exception]', err)
setTimeout(async () => {
await shutdown()
process.exit(1)
}, 200)
setTimeout(shutdown, 200)
})
}

function consistentConfigDir (versionPath, genesisPath, configPath) {
return exists(genesisPath) && exists(versionPath) && exists(configPath)
Expand Down
12 changes: 8 additions & 4 deletions app/src/renderer/App.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
<template lang="pug">
#app
app-header
#app-content: router-view
#app-content
router-view
app-footer
notifications(:notifications='notifications' theme='cosmos')
modal-help
session
</template>

<script>
import { mapGetters } from 'vuex'
import AppHeader from './components/common/AppHeader'
import AppHeader from 'common/AppHeader'
import AppFooter from 'common/AppFooter'
import Notifications from '@nylira/vue-notifications'
import ModalHelp from './components/common/NiModalHelp'
import Session from './components/common/NiSession'
import ModalHelp from 'common/NiModalHelp'
import Session from 'common/NiSession'
import store from './vuex/store'
export default {
name: 'app',
components: {
AppHeader,
AppFooter,
ModalHelp,
Notifications,
Session
Expand Down
91 changes: 34 additions & 57 deletions app/src/renderer/components/common/NiListItem.vue
Original file line number Diff line number Diff line change
@@ -1,79 +1,56 @@
<template lang="pug">
mixin ni-li-thumb
.ni-li-thumb
template(v-if='icon'): i.material-icons {{ icon }}
template(v-else-if='image'): img(:src='image')
template(v-else-if="$slots['graphic']"): slot(name='graphic')
mixin ni-li-dl
.ni-li-dl
.ni-li-dt {{ dt }}
.ni-li-dd.ni-li-dd-flush(v-if="$slots['dd']"): slot(name='dd')
.ni-li-dd(v-else) {{ dd }}
mixin ni-li-icon
.ni-li-icon
i.material-icons.inactive chevron_right
i.material-icons.active my_location
mixin ni-li-label
.ni-li-label
.ni-li-title {{ title }}
.ni-li-subtitle {{ subtitle }}
transition(name="proposal")
// dt/dd anchor
a.ni-li.ni-li-link(v-if='dt && href' :href="href"): .ni-li-container
.ni-li-thumb
template(v-if='icon'): i.material-icons {{ icon }}
template(v-else-if='image'): img(:src='image')
template(v-else-if="$slots['graphic']"): slot(name='graphic')
.ni-li-dl
.ni-li-dt {{ dt }}
.ni-li-dd.ni-li-dd-flush(v-if="$slots['dd']"): slot(name='dd')
.ni-li-dd(v-else) {{ dd }}
.ni-li-icon
i.material-icons.inactive chevron_right
i.material-icons.active my_location
+ni-li-thumb
+ni-li-dl
+ni-li-icon

// dt/dd router-link
router-link.ni-li.ni-li-link(v-else-if='dt && to' :to="to"): .ni-li-container
.ni-li-thumb
template(v-if='icon'): i.material-icons {{ icon }}
template(v-else-if='image'): img(:src='image')
template(v-else-if="$slots['graphic']"): slot(name='graphic')
.ni-li-dl
.ni-li-dt {{ dt }}
.ni-li-dd.ni-li-dd-flush(v-if="$slots['dd']"): slot(name='dd')
.ni-li-dd(v-else) {{ dd }}
.ni-li-icon
i.material-icons.inactive chevron_right
i.material-icons.active my_location
+ni-li-thumb
+ni-li-dl
+ni-li-icon

// dt/dd text
.ni-li(v-else-if='dt'): .ni-li-container
.ni-li-thumb
template(v-if='icon'): i.material-icons {{ icon }}
template(v-else-if='image'): img(:src='image')
template(v-else-if="$slots['graphic']"): slot(name='graphic')
.ni-li-dl
.ni-li-dt {{ dt }}
.ni-li-dd.ni-li-dd-flush(v-if="$slots['dd']"): slot(name='dd')
.ni-li-dd(v-else) {{ dd }}
+ni-li-thumb
+ni-li-dl

// title/subtitle anchor
a.ni-li.ni-li-link(v-else-if="href" :href="href"): .ni-li-container
.ni-li-thumb
template(v-if='icon'): i.material-icons {{ icon }}
template(v-else-if='image'): img(:src='image')
template(v-else-if="$slots['graphic']"): slot(name='graphic')
.ni-li-label
.ni-li-title {{ title }}
.ni-li-subtitle {{ subtitle }}
.ni-li-icon
i.material-icons.inactive chevron_right
i.material-icons.active my_location
+ni-li-thumb
+ni-li-label
+ni-li-icon

// title/subtitle router-link
router-link.ni-li.ni-li-link(v-else-if="to" :to='to'): .ni-li-container
.ni-li-thumb
template(v-if='icon'): i.material-icons {{ icon }}
template(v-else-if='image'): img(:src='image')
template(v-else-if="$slots['graphic']"): slot(name='graphic')
.ni-li-label
.ni-li-title {{ title }}
.ni-li-subtitle {{ subtitle }}
.ni-li-icon
i.material-icons.inactive chevron_right
i.material-icons.active my_location
+ni-li-thumb
+ni-li-label
+ni-li-icon

// title/subtitle text
.ni-li(v-else-if='title'): .ni-li-container
.ni-li-thumb
template(v-if='icon'): i.material-icons {{ icon }}
template(v-else-if='image'): img(:src='image')
template(v-else-if="$slots['graphic']"): slot(name='graphic')
.ni-li-label
.ni-li-title {{ title }}
.ni-li-subtitle {{ subtitle }}
+ni-li-thumb
+ni-li-label

// image
.ni-li(v-else-if="type === 'image'"): .ni-li-container: slot
Expand Down
2 changes: 1 addition & 1 deletion app/src/renderer/components/common/NiModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ div(:class='cssClass' @click="close()")
i.material-icons {{ icon }}
.ni-modal-title
slot(name='title')
.ni-modal-icon.ni-modal-close(@click="close(data)")
.ni-modal-icon.ni-modal-close(@click="close()")
i.material-icons close
main.ni-modal-main
slot
Expand Down
15 changes: 11 additions & 4 deletions app/src/renderer/components/common/NiModalSearch.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template lang='pug'>
.ni-modal-search: .ni-modal-search-container
.ni-modal-search(v-if="open"): .ni-modal-search-container
field.mousetrap(type="text" placeholder="Search..." v-model="query")
btn(icon="close" @click.native="close")
</template>
Expand All @@ -16,6 +16,9 @@ export default {
},
computed: {
...mapGetters(['filters']),
open () {
return this.filters[this.type].search.visible
},
query: {
get () {
return this.filters[this.type].search.query
Expand All @@ -30,9 +33,13 @@ export default {
this.$store.commit('setSearchVisible', [this.type, false])
}
},
mounted () {
let el = this.$el.querySelector('.ni-field')
el.select()
watch: {
open (open) {
if (open) {
let el = this.$el.querySelector('.ni-field')
el.select()
}
}
},
props: ['type']
}
Expand Down
14 changes: 5 additions & 9 deletions app/src/renderer/components/common/NiPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,27 @@
div(slot='subtitle') {{ subtitle }}
div(slot="menu"): slot(name="menu")
main.ni-page-main: slot
app-footer
</template>

<script>
import { mapGetters } from 'vuex'
import PerfectScrollbar from 'perfect-scrollbar'
import PageHeader from 'common/NiPageHeader'
import AppFooter from 'common/AppFooter'
import PageFooter from 'common/NiPageFooter'
export default {
name: 'ni-page',
props: ['title', 'subtitle', 'icon'],
components: {
PageHeader,
AppFooter
PageFooter
},
computed: {
...mapGetters(['config'])
},
mounted () {
let ps
if (this.config.desktop) {
ps = new PerfectScrollbar('.ni-page-main')
} else {
ps.destroy()
}
const container = this.$el.querySelector('.ni-page-main')
// eslint-disable-next-line no-new
new PerfectScrollbar(container)
}
}
</script>
Expand Down
3 changes: 1 addition & 2 deletions app/src/renderer/components/common/NiPageHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ header.ni-page-header

<script>
export default {
name: 'ni-page-header',
props: ['icon']
name: 'ni-page-header'
}
</script>

Expand Down
6 changes: 1 addition & 5 deletions app/src/renderer/components/common/NiUserPane.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ list-item.ni-li-user(
to="/profile"
@click.native="close"
icon="face"
title="CosmosUser01")
:title="'Account ' + user.account")
div(v-else-if="user.signedIn")
list-item.ni-li-user(
type="link"
Expand Down Expand Up @@ -36,10 +36,6 @@ export default {
this.$store.commit('setActiveMenu', '')
noScroll.off()
},
openSettings () {
window.alert('TODO: open user settings')
this.close()
},
openSession () {
this.$store.commit('setModalSession', true)
this.close()
Expand Down
2 changes: 1 addition & 1 deletion app/src/renderer/components/common/Page404.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<template lang="pug">
page(title='404 - Page Not Found')
part(title='Try another page...')
list-item(to='/' title='Balance')
list-item(to='/staking' title='Staking')
list-item(to='/signin' title='Sign In')
</template>

<script>
Expand Down
2 changes: 1 addition & 1 deletion app/src/renderer/components/govern/PageProposals.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ page(title='Proposals')
a(@click='setSearch(true)')
i.material-icons search
.label Search
modal-search(v-if="filters.proposals.search.visible" type="proposals")
modal-search(type="proposals")

data-empty(v-if="proposals.length === 0")
data-empty-search(v-else-if="filteredProposals.length === 0")
Expand Down
2 changes: 1 addition & 1 deletion app/src/renderer/components/monitor/PageValidators.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ page(title='Validators')
a(@click='setSearch(true)')
i.material-icons search
.label Search
modal-search(v-if="filters.validators.search.visible" type="validators")
modal-search(type="validators")

data-empty(v-if="validators.length === 0")
data-empty-search(v-else-if="filteredValidators.length === 0")
Expand Down
2 changes: 1 addition & 1 deletion app/src/renderer/components/staking/PageDelegates.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ page(:title='pageTitle')
i.material-icons check_circle
.label Bond Atoms

modal-search(v-if="filters.delegates.search.visible" type="delegates")
modal-search(type="delegates")

data-error(v-if="delegates.length === 0")
data-empty-search(v-if="filteredDelegates.length === 0")
Expand Down
2 changes: 1 addition & 1 deletion app/src/renderer/components/wallet/PageBalances.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ page(title='Balance')
i.material-icons search
.label Search

modal-search(v-if="filters.balances.search.visible" type="balances")
modal-search(type="balances")

part(title='Your Address')
li-copy(:value="wallet.key.address")
Expand Down
2 changes: 1 addition & 1 deletion app/src/renderer/components/wallet/PageTransactions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ page(title='Transactions')
i.material-icons search
.label Search

modal-search(v-if="filters.transactions.search.visible" type="transactions")
modal-search(type="transactions")

data-empty-tx(v-if='transactions.length === 0')
data-empty-search(v-else-if="filteredTransactions.length === 0")
Expand Down
2 changes: 2 additions & 0 deletions app/src/renderer/styles/app.styl
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ a

#app-content
flex 1
display flex
flex-flow column no-wrap

.desktop-only
display block
3 changes: 3 additions & 0 deletions app/src/renderer/vuex/modules/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ export default ({ commit, basecoin }) => {
}
}
const mutations = {
setDevMode (state, value) {
state.devMode = value
},
setModalHelp (state, value) {
state.modals.help.active = value
},
Expand Down
2 changes: 1 addition & 1 deletion app/src/renderer/vuex/modules/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default ({ commit, node }) => {
}

const actions = {
async showInitialScreen ({ dispatch }) {
async showInitialScreen ({ dispatch, commit }) {
await dispatch('loadAccounts')
let exists = state.accounts.length > 0
let screen = exists ? 'sign-in' : 'welcome'
Expand Down
2 changes: 1 addition & 1 deletion app/src/renderer/vuex/modules/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export default ({ commit, node }) => {
done(null, args)
dispatch('queryWalletBalances')
},
async loadDenoms () {
async loadDenoms ({ state, commit }) {
// read genesis.json to get default denoms

// wait for genesis.json to exist
Expand Down
Loading