From fbac6f5c852f8be2191e8b593405de39307cdf38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=C4=9F=C3=A7e=20K=C3=BC=C3=A7=C3=BCko=C4=9Flu?= Date: Thu, 17 Mar 2022 17:14:45 +0300 Subject: [PATCH] Update InputText.spec.js --- src/components/inputtext/InputText.spec.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/components/inputtext/InputText.spec.js b/src/components/inputtext/InputText.spec.js index 5466ccc16..fd9d75c34 100644 --- a/src/components/inputtext/InputText.spec.js +++ b/src/components/inputtext/InputText.spec.js @@ -13,18 +13,22 @@ describe('InputText.vue', () => { const input = wrapper.find('input'); expect(input.element.value).toEqual('PrimeVue'); - }) -}); + }); -describe('InputText.vue', () => { it('input event', async () => { const wrapper = mount(InputText); - const input = wrapper.find('input'); + const event = { target: { value: 'a' } }; - // await input.trigger('input', { keyCode: 65 }); - input.element.value = 'a'; - input.trigger('input'); + await wrapper.vm.onInput(event); - expect(input.element.value).toEqual('a'); - }) + expect(wrapper.emitted()['update:modelValue'][0]).toEqual(['a']); + }); + + it('should filled work', async () => { + const wrapper = mount(InputText); + + await wrapper.setProps({ modelValue: 'a' }); + + expect(wrapper.vm.filled).toBe(true); + }); }); \ No newline at end of file