From 80415e0b535932da65958ab48c8cb66a156a42f9 Mon Sep 17 00:00:00 2001 From: Jordan Bibla Date: Wed, 6 Mar 2019 07:35:54 -0500 Subject: [PATCH 1/6] fix page network block loading --- app/src/renderer/assets/images/loader.svg | 2 +- .../components/network/PageNetwork.vue | 24 ++- .../components/network/PageNetwork.spec.js | 16 +- .../__snapshots__/PageNetwork.spec.js.snap | 167 +++++++++++++++++- 4 files changed, 200 insertions(+), 9 deletions(-) diff --git a/app/src/renderer/assets/images/loader.svg b/app/src/renderer/assets/images/loader.svg index bfd8e2bf4a..2485049b76 100644 --- a/app/src/renderer/assets/images/loader.svg +++ b/app/src/renderer/assets/images/loader.svg @@ -1,5 +1,5 @@ - + diff --git a/app/src/renderer/components/network/PageNetwork.vue b/app/src/renderer/components/network/PageNetwork.vue index 0f28ac7c18..e1e6221328 100644 --- a/app/src/renderer/components/network/PageNetwork.vue +++ b/app/src/renderer/components/network/PageNetwork.vue @@ -40,9 +40,11 @@
Total Liquid {{ bondDenom }}
- {{ pool.pool && pool.pool.not_bonded_tokens ? num.pretty( - num.atoms(pool.pool.not_bonded_tokens) - ) : `n/a` }} + {{ + pool.pool && pool.pool.not_bonded_tokens + ? num.pretty(num.atoms(pool.pool.not_bonded_tokens)) + : `n/a` + }}
@@ -50,9 +52,11 @@
Total Delegated {{ bondDenom }}
- {{ pool.pool && pool.pool.bonded_tokens ? num.pretty( - num.atoms(pool.pool.bonded_tokens) - ) : `n/a` }} + {{ + pool.pool && pool.pool.bonded_tokens + ? num.pretty(num.atoms(pool.pool.bonded_tokens)) + : `n/a` + }}
@@ -63,6 +67,14 @@ + + + + + + + + { }) }) - it(`has the expected html structure`, () => { + it(`should display the network page with data and the blocks table`, () => { + expect(wrapper.vm.$el).toMatchSnapshot() + }) + + it(`should display the network page with the blocks table in a loading state`, () => { + $store.getters.blocks = [] + + wrapper = shallowMount(PageNetwork, { + localVue, + mocks: { + $store + }, + stubs: [`router-link`] + }) + expect(wrapper.vm.$el).toMatchSnapshot() }) diff --git a/test/unit/specs/components/network/__snapshots__/PageNetwork.spec.js.snap b/test/unit/specs/components/network/__snapshots__/PageNetwork.spec.js.snap index 57cb8cbb78..df926f091b 100644 --- a/test/unit/specs/components/network/__snapshots__/PageNetwork.spec.js.snap +++ b/test/unit/specs/components/network/__snapshots__/PageNetwork.spec.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`PageNetwork has the expected html structure 1`] = ` +exports[`PageNetwork should display the network page with data and the blocks table 1`] = ` + + @@ -178,3 +180,166 @@ exports[`PageNetwork has the expected html structure 1`] = ` `; + +exports[`PageNetwork should display the network page with the blocks table in a loading state 1`] = ` + +
+
+
+
+ + +

+ + gaia-20k + +

+
+
+
+ +
+
+
+ Block Height +
+ +
+ #6,001 +
+
+ +
+
+ Last Block +
+ +
+ a few seconds ago +
+
+ +
+
+ Transactions +
+ +
+ 108 +
+
+ +
+
+ Number of Validators +
+ +
+ 1 +
+
+
+ +
+
+
+
+ Total Liquid stake +
+ +
+ + 0.00 + +
+
+
+ +
+
+
+ Total Delegated stake +
+ +
+ + 0.00 + +
+
+
+
+
+ + + + + + + + + + + + + + +
+ + + +
+
+`; From 778f45d115c96eef6517d719b584412da72dee74 Mon Sep 17 00:00:00 2001 From: Jordan Bibla Date: Wed, 6 Mar 2019 07:46:27 -0500 Subject: [PATCH 2/6] changelog and random lints --- CHANGELOG.md | 1 + app/src/renderer/components/common/ActionModal.vue | 2 +- app/src/renderer/components/common/TmHardwareState.vue | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a22042ba7..fa38a98aef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Added - [\#1306](https://github.com/cosmos/voyager/issues/1306) Withdraw fee distribution rewards @fedekunze +- [\#2183](https://github.com/cosmos/voyager/issues/2183) Loading block to network block loader @jbibla ### Changed diff --git a/app/src/renderer/components/common/ActionModal.vue b/app/src/renderer/components/common/ActionModal.vue index c64553d492..bc146ac4e9 100644 --- a/app/src/renderer/components/common/ActionModal.vue +++ b/app/src/renderer/components/common/ActionModal.vue @@ -5,7 +5,7 @@ + > {{ session.signedIn ? title : `Sign in required` }} diff --git a/app/src/renderer/components/common/TmHardwareState.vue b/app/src/renderer/components/common/TmHardwareState.vue index e1df44ed3a..a2f318ac4d 100644 --- a/app/src/renderer/components/common/TmHardwareState.vue +++ b/app/src/renderer/components/common/TmHardwareState.vue @@ -1,6 +1,6 @@ @@ -104,7 +103,7 @@ export default { const uptimeRollingWindow = info.signed_blocks_counter / rollingWindow return `${this.num.pretty(uptimeRollingWindow * 100)}%` } - return `n/a` + return `--` }, yourVotes() { return this.committedDelegations[this.validator.operator_address] diff --git a/app/src/renderer/components/staking/TabStakingParameters.vue b/app/src/renderer/components/staking/TabStakingParameters.vue index c3a14c0e9f..1b09cb5ade 100644 --- a/app/src/renderer/components/staking/TabStakingParameters.vue +++ b/app/src/renderer/components/staking/TabStakingParameters.vue @@ -22,7 +22,7 @@ {{ stakingParameters.parameters.unbonding_time ? unbondingTimeInDays + ` days` - : `n/a` + : `--` }} @@ -40,7 +40,7 @@ {{ stakingParameters.parameters.max_validators ? stakingParameters.parameters.max_validators - : `n/a` + : `--` }} diff --git a/test/e2e/delegation.js b/test/e2e/delegation.js index 6d5c635cff..c6ccf0af64 100644 --- a/test/e2e/delegation.js +++ b/test/e2e/delegation.js @@ -11,7 +11,7 @@ const { * NOTE: don't use a global `let client = app.client` as the client object changes when restarting the app */ -test(`delegation`, async function(t) { +test(`delegation`, async function (t) { const { app } = await getApp(t) // app.env.COSMOS_MOCKED = false await restart(app) @@ -22,7 +22,7 @@ test(`delegation`, async function(t) { // default values from e2e mounted node const bondedStake = 100 - t.test(`Validators`, async function(t) { + t.test(`Validators`, async function (t) { // Select the Validators tab. await app.client.click(`//a[normalize-space() = 'Validators']`) @@ -154,7 +154,7 @@ test(`delegation`, async function(t) { t.end() }) - t.test(`showing transactions`, async function(t) { + t.test(`showing transactions`, async function (t) { await navigate(app, `Transactions`) // delegated @@ -173,7 +173,7 @@ test(`delegation`, async function(t) { t.end() }) - t.test(`Parameters`, async function(t) { + t.test(`Parameters`, async function (t) { await navigate(app, `Staking`) await app.client.click(`//a[normalize-space() = 'Parameters']`) await t.ok( @@ -191,7 +191,7 @@ test(`delegation`, async function(t) { `Shows staking parameters` ) await t.ok( - !(await app.client.isExisting(`//dd[contains(text(), "n/a")]`)), + !(await app.client.isExisting(`//dd[contains(text(), "--")]`)), `all parameters and pool fields are defined` ) await t.ok( diff --git a/test/unit/specs/components/network/__snapshots__/PageBlock.spec.js.snap b/test/unit/specs/components/network/__snapshots__/PageBlock.spec.js.snap index 0e3d78ae7b..93ba559dad 100644 --- a/test/unit/specs/components/network/__snapshots__/PageBlock.spec.js.snap +++ b/test/unit/specs/components/network/__snapshots__/PageBlock.spec.js.snap @@ -21,9 +21,7 @@ exports[`PageBlock shows a page with information about a certain block 1`] = `

- - Block #100 - + Block #100

- txs + + txs +
@@ -95,7 +95,9 @@ exports[`PageBlock shows a page with information about a certain block 1`] = `
- evidence + + evidence +
@@ -125,9 +127,7 @@ exports[`PageBlock shows the page when the block hasn't been loaded yet 1`] = `

- - Block n/a - + Block --

- n/a + --
@@ -175,7 +175,9 @@ exports[`PageBlock shows the page when the block hasn't been loaded yet 1`] = `
- No Transactions + + No Transactions +
@@ -199,7 +201,9 @@ exports[`PageBlock shows the page when the block hasn't been loaded yet 1`] = `
- No Evidence + + No Evidence +
diff --git a/test/unit/specs/components/staking/LiValidator.spec.js b/test/unit/specs/components/staking/LiValidator.spec.js index ccff5b49ca..a1f176d89d 100644 --- a/test/unit/specs/components/staking/LiValidator.spec.js +++ b/test/unit/specs/components/staking/LiValidator.spec.js @@ -137,7 +137,7 @@ describe(`LiValidator`, () => { }) }) - expect(wrapper.vm.uptime).toBe(`n/a`) + expect(wrapper.vm.uptime).toBe(`--`) }) it(`should show the validator's commission`, () => { diff --git a/test/unit/specs/components/staking/__snapshots__/LiValidator.spec.js.snap b/test/unit/specs/components/staking/__snapshots__/LiValidator.spec.js.snap index b84cbb653f..d71277544a 100644 --- a/test/unit/specs/components/staking/__snapshots__/LiValidator.spec.js.snap +++ b/test/unit/specs/components/staking/__snapshots__/LiValidator.spec.js.snap @@ -52,7 +52,7 @@ exports[`LiValidator has the expected html structure 1`] = ` class="li-validator__rewards data-table__row__cell__separator" > - n/a + -- @@ -84,7 +84,7 @@ exports[`LiValidator has the expected html structure 1`] = ` class="li-validator__slashes" > - n/a + -- @@ -142,7 +142,7 @@ exports[`LiValidator works if user is not signed in 1`] = ` class="li-validator__rewards data-table__row__cell__separator" > - n/a + -- @@ -174,7 +174,7 @@ exports[`LiValidator works if user is not signed in 1`] = ` class="li-validator__slashes" > - n/a + -- diff --git a/test/unit/specs/components/wallet/PageWallet.spec.js b/test/unit/specs/components/wallet/PageWallet.spec.js index 185339185e..ea07368ab4 100644 --- a/test/unit/specs/components/wallet/PageWallet.spec.js +++ b/test/unit/specs/components/wallet/PageWallet.spec.js @@ -50,7 +50,7 @@ describe(`PageWallet`, () => { expect(wrapper.findAll(`.tm-li-balance`).length).toBe(4) }) - it(`should show the n/a message if there are no denoms`, async () => { + it(`should show the '--' placeholder if there are no denoms`, async () => { wrapper.setData({ wallet: { denoms: [`fermion`, `gregcoin`, `mycoin`, `STAKE`], @@ -61,7 +61,7 @@ describe(`PageWallet`, () => { expect(wrapper.find(`#account_empty_msg`).exists()).toBeTruthy() }) - it(`should not show the n/a message if there are denoms`, () => { + it(`should not show the '--' placeholder if there are denoms`, () => { expect(wrapper.vm.allDenomBalances.length).not.toBe(0) expect(wrapper.vm.$el.querySelector(`#no-balances`)).toBe(null) })