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

Jordan/2170 explorer mode fixes #2176

Merged
merged 12 commits into from
Mar 7, 2019
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Changed

- [\#2128](https://github.com/cosmos/voyager/pull/2128) remove loading status on validator page when disconnected from the network @fedekunze
- [\#2170](https://github.com/cosmos/voyager/pull/2170) bug with card-signed-in and explorer mode @jbibla
- [\#2167](https://github.com/cosmos/voyager/pull/2167) fixed votes showing wrong tally @faboweb
- [\#2167](https://github.com/cosmos/voyager/pull/2167) fixed not being able to deposit less then 1 atom not possible @faboweb
- [\#2167](https://github.com/cosmos/voyager/pull/2167) fixed sorting of proposals @faboweb
Expand Down
3 changes: 2 additions & 1 deletion app/src/renderer/components/common/CardSignInRequired.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
Sign In Required
</div>
<div slot="subtitle">
This page shows data for your address. To access the page, please <a @click="goToSession">sign in</a>.
This page shows data for a specific address. To access the page, please
<a @click="goToSession">sign in</a>.
</div>
</tm-data-msg>
</template>
Expand Down
6 changes: 3 additions & 3 deletions app/src/renderer/components/common/TmPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
<slot slot="header-buttons" name="header-buttons" />
</tm-page-header>
<main class="tm-page-main">
<template v-if="this.$slots['managed-body']">
<card-sign-in-required v-if="signinRequired && !session.signedIn" />
<tm-data-connecting v-else-if="!loaded && !connected" />
<card-sign-in-required v-if="signInRequired && !session.signedIn" />
<template v-else-if="this.$slots['managed-body']">
<tm-data-connecting v-if="!loaded && !connected" />
<tm-data-loading v-else-if="!loaded && loading" />
<tm-data-error v-else-if="error" />
<slot
Expand Down
2 changes: 1 addition & 1 deletion app/src/renderer/components/governance/TabProposals.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<tm-data-empty
v-else-if="Object.keys(proposals.proposals).length === 0"
title="No Governance Proposals"
subtitle="There are currently no governance proposals on the Cosmos Hub. Submit a new one by clicking the 'Create Proposal' button above."
subtitle="There are currently no governance proposals to display. Click the 'Create Proposal' button to submit a proposal."
/>
<table-proposals
v-else
Expand Down
2 changes: 1 addition & 1 deletion app/src/renderer/components/wallet/PageWallet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default {
computed: {
...mapGetters([`wallet`, `connected`, `session`]),
enableFaucet() {
return !!this.wallet.externals.config.faucet
return !!this.wallet.externals.config.faucet && this.session.signedIn
},
allDenomBalances() {
// for denoms not in balances, add empty balance
Expand Down
15 changes: 4 additions & 11 deletions app/src/renderer/scripts/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@ export const routeGuard = store => (to, from, next) => {
name: `My Delegations`
})
next(to.path)
} else if (
!store.state.session.signedIn &&
to.matched.some(record => record.meta.requiresAuth)
) {
// redirect to session page if auth required
store.commit(`setSessionModalView`, `welcome`)
store.commit(`toggleSessionModal`, true)
}
next()
jbibla marked this conversation as resolved.
Show resolved Hide resolved
}
Expand All @@ -65,7 +58,7 @@ export const startApp = async (
// directive to focus form fields
/* istanbul ignore next */
Vue.directive(`focus`, {
inserted: function(el) {
inserted: function (el) {
el.focus()
}
})
Expand All @@ -83,11 +76,11 @@ export const startApp = async (

// handle uncaught errors
/* istanbul ignore next */
window.addEventListener(`unhandledrejection`, function(event) {
window.addEventListener(`unhandledrejection`, function (event) {
Sentry.captureException(event.reason)
})
/* istanbul ignore next */
window.addEventListener(`error`, function(event) {
window.addEventListener(`error`, function (event) {
Sentry.captureException(event.reason)
})

Expand All @@ -105,7 +98,7 @@ export const startApp = async (
})

router.beforeEach(routeGuard(store))

if (urlParams.experimental) {
store.commit(`setExperimentalMode`)
}
Expand Down
23 changes: 1 addition & 22 deletions test/unit/specs/App.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ describe(`App Start`, () => {
expect(commit).not.toHaveBeenCalled()
expect(next).toHaveBeenCalled()
})

it(`redirects to my validators`, async () => {
const commit = jest.fn()
const store = {
Expand All @@ -160,28 +161,6 @@ describe(`App Start`, () => {
guard(to, { fullPath: `/` }, next)
expect(next).toHaveBeenCalledWith(`/staking/my-delegations`)
})

it(`redirects to session page if not logged in`, async () => {
const commit = jest.fn()
const store = {
commit,
state: { session: { pauseHistory: false, signedIn: false } },
getters: { session: { pauseHistory: false, signedIn: false } }
}
const to = {
redirectedFrom: ``,
fullPath: `/wallet`,
path: `/wallet`,
name: `Wallet`,
matched: [{ meta: { requiresAuth: true } }]
}
const next = jest.fn()
const guard = routeGuard(store)
// from.fullPath !== to.fullPath && !store.getters.user.pauseHistory
guard(to, { fullPath: `/` }, next)
expect(commit).toHaveBeenCalledWith(`setSessionModalView`, `welcome`)
expect(commit).toHaveBeenCalledWith(`toggleSessionModal`, true)
})
})

it(`activates analytics`, async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ exports[`CardSignInRequired shows a sign in required card 1`] = `

<div>

This page shows data for your address. To access the page, please
This page shows data for a specific address. To access the page, please

faboweb marked this conversation as resolved.
Show resolved Hide resolved
<a>
sign in
faboweb marked this conversation as resolved.
Show resolved Hide resolved
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ exports[`TabProposals shows a message if there is nothing to display 1`] = `
>
<h5>

There are currently no governance proposals on the Cosmos Hub. Submit a new one by clicking the 'Create Proposal' button above.
There are currently no governance proposals to display. Click the 'Create Proposal' button to submit a proposal.

</h5>
</div>
Expand Down
24 changes: 18 additions & 6 deletions test/unit/specs/components/wallet/PageWallet.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,24 @@ describe(`PageWallet`, () => {
expect(wrapper.vm.$el).toMatchSnapshot()
})

it(`should show the sending modal`, () => {
wrapper.vm.showModal(`STAKE`)
expect(wrapper.exists(`send-modal`)).toBe(true)
expect(wrapper.vm.$el).toMatchSnapshot()
})

it(`should not show denoms or the faucet button for a user who is not signed in`, () => {
$store.getters.session.signedIn = false
wrapper = shallowMount(PageWallet, {
localVue,
mocks: {
$store
}
})

expect(wrapper.vm.$el).toMatchSnapshot()
})

it(`should sort the balances by amount desc and denom asc`, () => {
expect(wrapper.vm.filteredBalances.map(x => x.denom)).toEqual([
`fermion`,
Expand Down Expand Up @@ -122,12 +140,6 @@ describe(`PageWallet`, () => {
expect(wrapper.exists(`tm-data-loading`)).toBe(true)
})

it(`should show the sending modal`, () => {
wrapper.vm.showModal(`STAKE`)
expect(wrapper.exists(`send-modal`)).toBe(true)
expect(wrapper.vm.$el).toMatchSnapshot()
})

it(`should call getmoney`, async () => {
await PageWallet.methods.faucet.call({
$store, session: { signedIn: true, address: `cosmos1address` }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,59 @@ exports[`PageWallet should display the wallet page 1`] = `
</tm-page-stub>
`;

exports[`PageWallet should not show denoms or the faucet button for a user who is not signed in 1`] = `
<tm-page-stub
data-title="Wallet"
dataset="[object Object],[object Object],[object Object]"
refresh="function () { [native code] }"
signinrequired="true"
subtitle=""
title=""
>
<tm-data-msg-stub
icon="help_outline"
id="account_empty_msg"
>
<div>

Account empty

</div>

<div>

This account doesn't have anything in it yet.

</div>
</tm-data-msg-stub>

<li-coin-stub
class="tm-li-balance"
coin="[object Object]"
/>
<li-coin-stub
class="tm-li-balance"
coin="[object Object]"
/>
<li-coin-stub
class="tm-li-balance"
coin="[object Object]"
/>
<li-coin-stub
class="tm-li-balance"
coin="[object Object]"
/>

<!---->

<send-modal-stub />
</tm-page-stub>
`;

exports[`PageWallet should show the sending modal 1`] = `
<tm-page-stub
data-title="Wallet"
dataset=""
dataset="[object Object],[object Object],[object Object]"
refresh="function () { [native code] }"
signinrequired="true"
subtitle=""
Expand Down