Skip to content

Commit

Permalink
smallest and string format
Browse files Browse the repository at this point in the history
  • Loading branch information
Federico Kunze committed Mar 15, 2019
1 parent 6e7f8d2 commit 195129e
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 27 deletions.
4 changes: 2 additions & 2 deletions app/src/renderer/scripts/num.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import BigNumber from "bignumber.js"
* @module num
*/

const SMALLEST = 1e-7
const SMALLEST = 1e-6
const language = window.navigator.userLanguage || window.navigator.language
function full(number = 0) {
return new Intl.NumberFormat(language, { minimumFractionDigits: 7 })
return new Intl.NumberFormat(language, { minimumFractionDigits: 6 })
.format(number)
}
function shortNumber(number = 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ exports[`PageNetwork should display the network page with data and the blocks ta
id="loose_tokens"
>
0.0000100
0.000010
</dd>
</dl>
Expand All @@ -124,7 +124,7 @@ exports[`PageNetwork should display the network page with data and the blocks ta
id="bonded_tokens"
>
0.0001250
0.000125
</dd>
</dl>
Expand Down Expand Up @@ -288,7 +288,7 @@ exports[`PageNetwork should display the network page with the blocks table in a
id="loose_tokens"
>
0.0000100
0.000010
</dd>
</dl>
Expand All @@ -308,7 +308,7 @@ exports[`PageNetwork should display the network page with the blocks table in a
id="bonded_tokens"
>
0.0001250
0.000125
</dd>
</dl>
Expand Down
6 changes: 3 additions & 3 deletions test/unit/specs/components/staking/PageValidator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ describe(`PageValidator`, () => {
const delegationString = PageValidator.computed.myDelegation.call(
{ bondDenom, myBond }
)
expect(delegationString).toBe(`10.0000000 stake`)
expect(delegationString).toBe(`10.000000 stake`)
})

it(`when user doesn't have any delegations`, () => {
Expand Down Expand Up @@ -232,7 +232,7 @@ describe(`PageValidator`, () => {
const rewardsString = PageValidator.computed.rewards.call(
{ session, bondDenom, distribution, validator }
)
expect(rewardsString).toBe(`100.0000000 stake`)
expect(rewardsString).toBe(`100.000000 stake`)
})

it(`when validator rewards are 0`, () => {
Expand All @@ -246,7 +246,7 @@ describe(`PageValidator`, () => {
const rewardsString = PageValidator.computed.rewards.call(
{ session, bondDenom, distribution, validator }
)
expect(rewardsString).toBe(`0.0000000 stake`)
expect(rewardsString).toBe(`0.000000 stake`)
})

it(`when user doesn't have any delegations`, () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ exports[`PageValidator shows a validator profile information errors signing info
</dt>
<dd>
0.0000000 STAKE
0.000000 STAKE
</dd>
</dl>
</div>
Expand Down Expand Up @@ -417,7 +417,7 @@ exports[`PageValidator shows a validator profile information if user has signed
</dt>
<dd>
0.0000000 STAKE
0.000000 STAKE
</dd>
</dl>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe(`LiStakeTransaction`, () => {
propsData.unbondingTime = Date.now() - 1000
wrapper.setProps({ unbondingTime: Date.now() - 1000 })
expect(wrapper.vm.$el).toMatchSnapshot()
expect(wrapper.text()).toContain(`10,000.0000000`)
expect(wrapper.text()).toContain(`10,000.000000`)
})

it(`should default to ended if no unbonding delegation is present`, () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ exports[`LiBankTransaction should show bank transaction when user hasn't signed
Sent 
<b>
12,340.0000000
12,340.000000
</b>
<span>
Expand Down Expand Up @@ -44,7 +44,7 @@ exports[`LiBankTransaction should show incoming transactions 1`] = `
Received 
<b>
12,340.0000000
12,340.000000
</b>
<span>
Expand Down Expand Up @@ -72,7 +72,7 @@ exports[`LiBankTransaction should show outgoing transactions 1`] = `
Sent 
<b>
12,340.0000000
12,340.000000
</b>
<span>
Expand Down Expand Up @@ -101,7 +101,7 @@ exports[`LiBankTransaction should show outgoing transactions send to herself 1`]
Sent 
<b>
12,340.0000000
12,340.000000
</b>
<span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exports[`LiGovTransaction deposits 1`] = `
Deposit 
<b>
1,000.0000000
1,000.000000
</b>
<span>
Expand Down Expand Up @@ -45,7 +45,7 @@ exports[`LiGovTransaction proposals 1`] = `
Submit text proposal 
<b>
1,000.0000000
1,000.000000
</b>
<span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exports[`LiStakeTransaction create validator 1`] = `
Create validator 
<b>
1.0000000
1.000000
</b>
<span>
Expand Down Expand Up @@ -45,7 +45,7 @@ exports[`LiStakeTransaction delegations should show delegations 1`] = `
Delegation 
<b>
42,000.0000000
42,000.000000
</b>
<span>
Expand Down Expand Up @@ -101,7 +101,7 @@ exports[`LiStakeTransaction redelegations should show redelegations and calculat
<b>
30.0000000
30.000000
</b>
Expand Down Expand Up @@ -147,7 +147,7 @@ exports[`LiStakeTransaction unbonding delegations should default to ended if no
<b>
10,000.0000000
10,000.000000
</b>
Expand Down Expand Up @@ -185,7 +185,7 @@ exports[`LiStakeTransaction unbonding delegations should show unbonding delegati
<b>
10,000.0000000
10,000.000000
</b>
Expand Down Expand Up @@ -223,7 +223,7 @@ exports[`LiStakeTransaction unbonding delegations should show unbondings and cal
<b>
10,000.0000000
10,000.000000
</b>
Expand Down
2 changes: 1 addition & 1 deletion test/unit/specs/components/wallet/LiCoin.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe(`LiCoin`, () => {
})

it(`should calculate the full amount of the coin`, () => {
expect(wrapper.vm.amount).toEqual(`10,000.0000000`)
expect(wrapper.vm.amount).toEqual(`10,000.000000`)
})

it(`should capitalize the coin denomination`, () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ exports[`LiCoin has the expected html structure 1`] = `
class="coin-amount"
>
10,000.0000000
10,000.000000
</p>
</div>
Expand Down
2 changes: 1 addition & 1 deletion test/unit/specs/scripts/num.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import num from "renderer/scripts/num"

describe(`number helper`, () => {
it(`should format numbers showing many decimals`, () => {
expect(num.full(1001950.123456)).toBe(`1,001,950.1234560`)
expect(num.full(1001950.123456)).toBe(`1,001,950.123456`)
})

it(`should format numbers showing many decimals`, () => {
Expand Down

0 comments on commit 195129e

Please sign in to comment.