Show chars captcha even "invisible" is on

This commit is contained in:
Pig Fang 2019-04-04 10:19:32 +08:00
parent c5eefbd061
commit e2c6028196
2 changed files with 7 additions and 2 deletions

View File

@ -60,7 +60,7 @@ export default {
methods: {
execute() {
return new Promise(resolve => {
if (this.invisible) {
if (this.recaptcha && this.invisible) {
this.$refs.recaptcha.$once('verify', resolve)
this.$refs.recaptcha.execute()
} else {

View File

@ -41,8 +41,13 @@ test('display characters captcha', async () => {
blessing.extra = {}
const wrapper = mount<Vue & { execute(): Promise<string> }>(Captcha)
expect(wrapper.find('img').exists()).toBeTrue()
wrapper.find('input').setValue('abc')
const input = wrapper.find('input')
input.setValue('abc')
expect(await wrapper.vm.execute()).toBe('abc')
wrapper.setData({ invisible: true })
input.setValue('123')
expect(await wrapper.vm.execute()).toBe('123')
})
test('refresh captcha', () => {