From 12ce5da3f5ee7210d34cbcb4b92a0bbdd05ca09e Mon Sep 17 00:00:00 2001 From: Alexander Shabunevich Date: Tue, 9 Apr 2024 22:29:57 +0300 Subject: [PATCH] chore: rename directive.test to vue.test --- test/{directive.test.ts => vue.test.ts} | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) rename test/{directive.test.ts => vue.test.ts} (93%) diff --git a/test/directive.test.ts b/test/vue.test.ts similarity index 93% rename from test/directive.test.ts rename to test/vue.test.ts index 0547352..27b7c5b 100644 --- a/test/directive.test.ts +++ b/test/vue.test.ts @@ -4,6 +4,7 @@ import { mount } from '@vue/test-utils' import BindCompleted from './components/BindCompleted.vue' import BindMasked from './components/BindMasked.vue' +import BindModel from './components/BindModel.vue' import BindUnmasked from './components/BindUnmasked.vue' import Callbacks from './components/Callbacks.vue' import ChangeValue from './components/ChangeValue.vue' @@ -108,6 +109,23 @@ test('bind completed', async () => { expect(wrapper.get('div').element.textContent).toBe('Completed') }) +test('bind v-model', async () => { + const wrapper = mount(BindModel) + const input = wrapper.get('input') + + await new Promise((r) => setTimeout(r)) + + expect(input.element.value).toBe('1-2') + expect(wrapper.get('#value1').element.textContent).toBe('1-2') + expect(wrapper.get('#value2').element.textContent).toBe('12') + + await input.setValue('345') + + expect(input.element.value).toBe('3-4') + expect(wrapper.get('#value1').element.textContent).toBe('3-4') + expect(wrapper.get('#value2').element.textContent).toBe('34') +}) + test('v-model', async () => { const wrapper = mount(Model) const input = wrapper.get('input')