Skip to content

Commit f81695b

Browse files
authoredMar 3, 2019
fix: stub model option (#1166)
1 parent 3c597d3 commit f81695b

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed
 

‎packages/create-instance/create-component-stubs.js

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ function getCoreProperties(componentOptions: Component): Object {
3838
return {
3939
attrs: componentOptions.attrs,
4040
name: componentOptions.name,
41+
model: componentOptions.model,
4142
props: componentOptions.props,
4243
on: componentOptions.on,
4344
key: componentOptions.key,

‎test/specs/shallow-mount.spec.js

+22
Original file line numberDiff line numberDiff line change
@@ -554,4 +554,26 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
554554
)
555555
}
556556
)
557+
558+
itDoNotRunIf(vueVersion < 2.2, 'stubs model', () => {
559+
const ChildComponent = {
560+
template: '<div />',
561+
model: {
562+
prop: 'a',
563+
event: 'change'
564+
},
565+
props: ['a']
566+
}
567+
const TestComponent = {
568+
template: '<child-component v-model="val" />',
569+
data() {
570+
return {
571+
val: '123'
572+
}
573+
},
574+
components: { ChildComponent }
575+
}
576+
const wrapper = shallowMount(TestComponent)
577+
expect(wrapper.find(ChildComponent).vm.a).to.equal('123')
578+
})
557579
})

0 commit comments

Comments
 (0)
Please sign in to comment.