Skip to content

Commit 7d5e34c

Browse files
committed
fix(v-model): add failing test for vuejs#9330.
1 parent 730a10f commit 7d5e34c

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/unit/features/directives/model-component.spec.js

+26
Original file line numberDiff line numberDiff line change
@@ -204,4 +204,30 @@ describe('Directive v-model component', () => {
204204
expect(triggerCount).toBe(1)
205205
document.body.removeChild(vm.$el)
206206
})
207+
208+
// #9330
209+
it('should add value to $attrs if not defined in props', () => {
210+
const TestComponent = {
211+
inheritAttrs: false,
212+
render (h) {
213+
return h('div', this.$attrs.value)
214+
}
215+
}
216+
217+
const vm = new Vue({
218+
components: {
219+
TestComponent
220+
},
221+
template: `
222+
<div>
223+
<test-component v-model="val"/>
224+
</div>
225+
`,
226+
data: {
227+
val: 'foo'
228+
}
229+
}).$mount()
230+
231+
expect(vm.$el.innerHTML).toBe('<div>foo</div>');
232+
})
207233
})

0 commit comments

Comments
 (0)