MCPcopy
hub / github.com/vuejs/core / runTestWithModifier

Function runTestWithModifier

packages/vue-compat/__tests__/componentVModel.spec.ts:86–122  ·  view source on GitHub ↗
(CustomInput: ComponentOptions)

Source from the content-addressed store, hash-verified

84 })
85
86 async function runTestWithModifier(CustomInput: ComponentOptions) {
87 const vm = new Vue({
88 data() {
89 return {
90 text: ' foo ',
91 }
92 },
93 components: {
94 CustomInput,
95 },
96 template: `
97 <div>
98 <span>{{ text }}</span>
99 <custom-input v-model.trim="text"></custom-input>
100 </div>
101 `,
102 }).$mount() as any
103
104 const input = vm.$el.querySelector('input')
105 const span = vm.$el.querySelector('span')
106
107 expect(input.value).toBe(' foo ')
108 expect(span.textContent).toBe(' foo ')
109
110 expect(
111 (deprecationData[DeprecationTypes.COMPONENT_V_MODEL].message as Function)(
112 CustomInput,
113 ),
114 ).toHaveBeenWarned()
115
116 input.value = ' bar '
117 triggerEvent(input, 'input')
118 await nextTick()
119
120 expect(input.value).toBe('bar')
121 expect(span.textContent).toBe('bar')
122 }
123
124 test('with model modifiers', async () => {
125 await runTestWithModifier({

Callers 1

Calls 5

triggerEventFunction · 0.90
nextTickFunction · 0.90
$mountMethod · 0.80
querySelectorMethod · 0.80
toHaveBeenWarnedMethod · 0.80

Tested by

no test coverage detected