type === `Text` || type === `ParameterChange` || type === `SoftwareUpgrade`
@@ -86,7 +100,8 @@ export default {
Modal,
TmBtn,
TmField,
- TmFormGroup
+ TmFormGroup,
+ TmFormMsg
},
props: {
denom: {
@@ -122,22 +137,14 @@ export default {
return {
title: {
required,
- minLength(x) {
- return minLength(this.titleMinLength)(x)
- },
- maxLength(x) {
- return maxLength(this.titleMaxLength)(x)
- },
+ minLength: minLength(this.titleMinLength),
+ maxLength: maxLength(this.titleMaxLength),
notBlank
},
description: {
required,
- minLength(x) {
- return minLength(this.descriptionMinLength)(x)
- },
- maxLength(x) {
- return maxLength(this.descriptionMaxLength)(x)
- },
+ minLength: minLength(this.descriptionMinLength),
+ maxLength: maxLength(this.descriptionMaxLength),
notBlank
},
type: {
diff --git a/app/src/renderer/components/governance/PageProposal.vue b/app/src/renderer/components/governance/PageProposal.vue
index 071368b9f6..0dd09b1f13 100644
--- a/app/src/renderer/components/governance/PageProposal.vue
+++ b/app/src/renderer/components/governance/PageProposal.vue
@@ -184,7 +184,7 @@ export default {
return moment(new Date(this.proposal.submit_time)).fromNow()
},
votingStartedAgo() {
- return moment(new Date(this.proposal.voting_start_block)).fromNow()
+ return moment(new Date(this.proposal.voting_start_time)).fromNow()
},
depositEndsIn() {
return moment(new Date(this.proposal.deposit_end_time)).fromNow()
diff --git a/test/unit/specs/components/governance/ModalPropose.spec.js b/test/unit/specs/components/governance/ModalPropose.spec.js
index 847b90ab4d..a32d44c61f 100644
--- a/test/unit/specs/components/governance/ModalPropose.spec.js
+++ b/test/unit/specs/components/governance/ModalPropose.spec.js
@@ -92,6 +92,22 @@ describe(`ModalPropose`, () => {
expect(proposeBtn.html()).toContain(`disabled="disabled"`)
})
+ it(`if title is too long disable submit button and show error message`, () => {
+ wrapper.setData({ title: `x`.repeat(65) })
+ let proposeBtn = wrapper.find(`#submit-proposal`)
+ expect(proposeBtn.html()).toContain(`disabled="disabled"`)
+ let errorMessage = wrapper.find(`input#title + div`)
+ expect(errorMessage.classes()).toContain(`tm-form-msg--error`)
+ })
+
+ it(`if description is too long disable submit button and show error message`, () => {
+ wrapper.setData({ description: `x`.repeat(201) })
+ let proposeBtn = wrapper.find(`#submit-proposal`)
+ expect(proposeBtn.html()).toContain(`disabled="disabled"`)
+ let errorMessage = wrapper.find(`textarea#description + div`)
+ expect(errorMessage.classes()).toContain(`tm-form-msg--error`)
+ })
+
it(`if proposal type is invalid`, () => {
wrapper.setData({ type: `Other` })
let proposeBtn = wrapper.find(`#submit-proposal`)
diff --git a/test/unit/specs/components/governance/__snapshots__/ModalPropose.spec.js.snap b/test/unit/specs/components/governance/__snapshots__/ModalPropose.spec.js.snap
index 443eaff2ab..32fd070734 100644
--- a/test/unit/specs/components/governance/__snapshots__/ModalPropose.spec.js.snap
+++ b/test/unit/specs/components/governance/__snapshots__/ModalPropose.spec.js.snap
@@ -31,7 +31,7 @@ exports[`ModalPropose component matches snapshot has the expected html structure
@@ -48,11 +48,13 @@ exports[`ModalPropose component matches snapshot has the expected html structure
placeholder="Proposal title"
type="text"
/>
+
+
@@ -68,6 +70,8 @@ exports[`ModalPropose component matches snapshot has the expected html structure
id="description"
placeholder="Write your proposal here..."
/>
+
+