Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

feat: make voting easier with delegate modal #1027

Merged
merged 42 commits into from
Mar 1, 2019
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
51e3609
fix: transaction vote form voter count
dated Jan 26, 2019
31d3f8f
fix: rounded corners on wallet show
dated Jan 27, 2019
23e0341
feat: initial implementation of select delegate modal
dated Jan 27, 2019
5ea7e14
feat: allow searching by full address and public key
dated Jan 27, 2019
8fff3e5
Merge remote-tracking branch 'upstream/develop' into wallet-vote
dated Jan 29, 2019
730cdd9
refactor: handle voting through WalletDetails component
dated Jan 29, 2019
e09f55e
Merge remote-tracking branch 'upstream/develop' into wallet-vote
dated Jan 29, 2019
ba46c6b
Merge branch 'develop' into wallet-vote
j-a-m-l Jan 30, 2019
df71505
Merge branch 'develop' into wallet-vote
dated Jan 30, 2019
1b4fd7c
refactor: handle vote if confirmed during broadcast
dated Jan 30, 2019
f618591
refactor: fix input delegate validation
dated Jan 31, 2019
a5b8f88
test: add basic input delegate tests
dated Jan 31, 2019
1f1409d
Merge branch 'develop' into wallet-vote
dated Feb 5, 2019
c191f8f
misc: rename accumulators
dated Feb 5, 2019
4be8e17
Merge branch 'develop' into wallet-vote
j-a-m-l Feb 7, 2019
fd16361
Merge remote-tracking branch 'upstream/develop' into wallet-vote
dated Feb 13, 2019
0d7403b
refactor: store votes in session
dated Feb 14, 2019
b8db302
Merge branch 'develop' into wallet-vote
dated Feb 15, 2019
5c6c69c
Merge branch 'develop' into wallet-vote
dated Feb 20, 2019
f098dd2
refactor: persistently store unconfirmed votes on profile
dated Feb 20, 2019
aa0d394
Merge branch 'develop' into wallet-vote
dated Feb 21, 2019
c8e776d
fix: set unconfirmedVotes if not present on profile
dated Feb 22, 2019
85ca652
Merge branch 'develop' into wallet-vote
dated Feb 22, 2019
f03c163
fix: dispatch from root context
dated Feb 26, 2019
9802993
misc: wording
dated Feb 26, 2019
01514ef
misc: wording
dated Feb 26, 2019
bab8af5
refactor: always show search button
dated Feb 26, 2019
acfdd7c
fix: add rounded border if not voting
dated Feb 26, 2019
0e6870f
Merge branch 'develop' into wallet-vote
dated Feb 27, 2019
7e43bd1
Merge branch 'develop' into wallet-vote
dated Feb 28, 2019
3d6cce6
test: fix required property errors
dated Feb 28, 2019
08726bf
misc: coding style
dated Feb 28, 2019
cb611d5
fix: pass selectedDelegate to transaction modal
dated Feb 28, 2019
77f2cc7
refactor: add search getter to delegate store
dated Feb 28, 2019
0c15d61
misc: display notice that wallet is already voting
dated Feb 28, 2019
2c642e2
fix: correctly establish if voting or unvoting
dated Feb 28, 2019
9d88536
misc: wording
dated Feb 28, 2019
acc5712
fix: set selectedDelegate
dated Feb 28, 2019
c7d401b
Merge branch 'develop' into wallet-vote
dated Mar 1, 2019
96fed81
refactor: fetch wallet vote only when not awaiting confirmation
dated Mar 1, 2019
fe65d08
misc: coding style in InputAddress.vue
dated Mar 1, 2019
5392362
refactor: fetch wallet vote only when changing from true -> false
dated Mar 1, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions __tests__/unit/components/Input/InputDelegate.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import { merge } from 'lodash'
import Vue from 'vue'
import Vuelidate from 'vuelidate'
import { mount } from '@vue/test-utils'
import { useI18n } from '../../__utils__/i18n'
import { InputDelegate } from '@/components/Input'
import delegates from '../../__fixtures__/store/delegate'

Vue.use(Vuelidate)
const i18n = useI18n(Vue)

describe('InputDelegate', () => {
const mountComponent = config => {
return mount(InputDelegate, merge({
i18n,
mocks: {
wallet_name: value => value,
wallet_truncate: value => value,
$store: {
getters: {
'delegate/byUsername': value => value,
'delegate/byAddress': value => value,
'delegate/byPublicKey': value => value,
'delegate/bySessionNetwork': delegates
}
}
}
}, config))
}

it('has the right name', () => {
const wrapper = mountComponent()
expect(wrapper.name()).toEqual('InputDelegate')
})

it('should render', () => {
const wrapper = mountComponent()
expect(wrapper.contains('.InputDelegate')).toBeTruthy()
})

describe('when receiving the `helperText` prop', () => {
it('should show a helper text', () => {
const helperText = 'example text'
const wrapper = mountComponent({
propsData: { helperText }
})
const helper = wrapper.find('.InputField__helper')
expect(helper.text()).toBe(helperText)
})
})

describe('when the input value changes', () => {
it('should emit the `input` event', () => {
const wrapper = mountComponent()
wrapper.find('.InputDelegate input').setValue('not empty')

expect(wrapper.emitted('input')).toBeTruthy()
})

it('should emit the `valid` event', () => {
const wrapper = mountComponent()
wrapper.find('.InputDelegate input').setValue('not empty')

expect(wrapper.emitted('valid')).toBeTruthy()
})
})

describe('when the value is not valid', () => {
// FIXME: Vuelidate is not updating the $dirty state
xit('should show the error instead of the helper text', () => {
const wrapper = mountComponent()
wrapper.find('.InputDelegate input').setValue('not empty')

const helper = wrapper.find('.InputField__helper')

expect(wrapper.vm.error).toMatch(/could not be found/)
expect(helper.text()).toMatch(/could not be found/)
})
})

describe('when focus', () => {
it('should focus the input', () => {
const wrapper = mountComponent()
wrapper.vm.focus()
expect(wrapper.vm.isFocused).toBeTrue()
})

it('should emit the `focus` event', () => {
const wrapper = mountComponent()
wrapper.vm.focus()
expect(wrapper.emitted('focus')).toBeTruthy()
})
})
})
2 changes: 1 addition & 1 deletion src/renderer/components/Button/ButtonModal.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<button
class="flex items-center justify-center"
@click="toggle"
@click.stop="toggle"
>
<SvgIcon
v-if="icon"
Expand Down
Loading