diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c3461acc5..abc0dd92b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - [\#1672](https://github.com/cosmos/voyager/issues/1672) added e2e tests for staking parameters tab @fedekunze - [\#1550](https://github.com/cosmos/voyager/issues/1578) added e2e tests for voting on governance proposals @fedekunze - [\#1555](https://github.com/cosmos/voyager/issues/1578) added e2e tests for submitting a deposit on a governance proposal @fedekunze +- [\#1681](https://github.com/cosmos/voyager/issues/1681) Governance: Fixed voting starting date @sabau +- [\#1690](https://github.com/cosmos/voyager/issues/1690) Governance: Fixed error messages for maxLength @sabau ### Changed diff --git a/app/src/renderer/components/governance/ModalPropose.vue b/app/src/renderer/components/governance/ModalPropose.vue index d3aa701362..7f5c2549fd 100644 --- a/app/src/renderer/components/governance/ModalPropose.vue +++ b/app/src/renderer/components/governance/ModalPropose.vue @@ -9,27 +9,42 @@ close - Title + + Title + - Description + + Description + - Deposit amount + + Deposit amount 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..." /> + +