test: Test logic refactor
This commit is contained in:
parent
509aa44710
commit
0cba9e56b3
@ -19,21 +19,18 @@ describe('FormularioFieldGroup', () => {
|
|||||||
<input type="text" v-model="context.model">
|
<input type="text" v-model="context.model">
|
||||||
</FormularioField>
|
</FormularioField>
|
||||||
</FormularioFieldGroup>
|
</FormularioFieldGroup>
|
||||||
`
|
`,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(wrapper.findAll('input[type="text"]').length).toBe(1)
|
wrapper.find('input').setValue('test')
|
||||||
|
|
||||||
wrapper.find('input[type="text"]').setValue('test')
|
|
||||||
wrapper.find('form').trigger('submit')
|
wrapper.find('form').trigger('submit')
|
||||||
|
|
||||||
await flushPromises()
|
await flushPromises()
|
||||||
|
|
||||||
const emitted = wrapper.emitted()
|
expect(wrapper.emitted('submit')).toEqual([
|
||||||
|
[{ group: { text: 'test' } }],
|
||||||
expect(emitted['submit']).toBeTruthy()
|
])
|
||||||
expect(emitted['submit']).toEqual([[{ group: { text: 'test' } }]])
|
|
||||||
})
|
})
|
||||||
|
|
||||||
test('grouped fields to be got', async () => {
|
test('grouped fields to be got', async () => {
|
||||||
@ -51,10 +48,11 @@ describe('FormularioFieldGroup', () => {
|
|||||||
<input type="text" v-model="context.model">
|
<input type="text" v-model="context.model">
|
||||||
</FormularioField>
|
</FormularioField>
|
||||||
</FormularioFieldGroup>
|
</FormularioFieldGroup>
|
||||||
`
|
`,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
expect(wrapper.find('input[type="text"]').element['value']).toBe('Group text')
|
|
||||||
|
expect(wrapper.find('input').element['value']).toBe('Group text')
|
||||||
})
|
})
|
||||||
|
|
||||||
test('data reactive with grouped fields', async () => {
|
test('data reactive with grouped fields', async () => {
|
||||||
@ -69,12 +67,12 @@ describe('FormularioFieldGroup', () => {
|
|||||||
</FormularioField>
|
</FormularioField>
|
||||||
</FormularioFieldGroup>
|
</FormularioFieldGroup>
|
||||||
</FormularioForm>
|
</FormularioForm>
|
||||||
`
|
`,
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(wrapper.find('span').text()).toBe('')
|
expect(wrapper.find('span').text()).toBe('')
|
||||||
|
|
||||||
wrapper.find('input[type="text"]').setValue('test')
|
wrapper.find('input').setValue('test')
|
||||||
|
|
||||||
await flushPromises()
|
await flushPromises()
|
||||||
|
|
||||||
@ -94,6 +92,7 @@ describe('FormularioFieldGroup', () => {
|
|||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(wrapper.findAll('span').length).toBe(1)
|
expect(wrapper.findAll('span').length).toBe(1)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user