Skip to content

Commit 6c715de

Browse files
38elementseddyerburgh
authored andcommitted
test: fix flow errors (#383)
1 parent 6689dbc commit 6c715de

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/wrappers/wrapper.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,18 +452,21 @@ export default class Wrapper implements BaseWrapper {
452452
if (!this.isVueComponent || !this.vm) {
453453
throwError('wrapper.setProps() can only be called on a Vue instance')
454454
}
455-
if (!this.vm.$options.propsData) {
455+
if (this.vm && this.vm.$options && !this.vm.$options.propsData) {
456456
this.vm.$options.propsData = {}
457457
}
458458
Object.keys(data).forEach((key) => {
459459
// $FlowIgnore : Problem with possibly null this.vm
460460
if (this.vm._props) {
461461
this.vm._props[key] = data[key]
462+
// $FlowIgnore : Problem with possibly null this.vm.$props
462463
this.vm.$props[key] = data[key]
464+
// $FlowIgnore : Problem with possibly null this.vm.$options
463465
this.vm.$options.propsData[key] = data[key]
464466
} else {
465467
// $FlowIgnore : Problem with possibly null this.vm
466468
this.vm[key] = data[key]
469+
// $FlowIgnore : Problem with possibly null this.vm.$options
467470
this.vm.$options.propsData[key] = data[key]
468471
}
469472
})

0 commit comments

Comments
 (0)