Skip to content

Commit

Permalink
fix: add $set scoped slot helper (#1287)
Browse files Browse the repository at this point in the history
fixes #1253
  • Loading branch information
piktur authored and eddyerburgh committed Aug 11, 2019
1 parent a65da38 commit a9eea7b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/create-instance/create-scoped-slots.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function getVueTemplateCompilerHelpers(
helpers[name] = vue._renderProxy[name]
})
helpers.$createElement = vue._renderProxy.$createElement
helpers.$set = vue._renderProxy.$set
return helpers
}

Expand Down
23 changes: 23 additions & 0 deletions test/specs/mounting-options/scopedSlots.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,4 +305,27 @@ describeWithShallowAndMount('scopedSlots', mountingMethod => {
expect(wrapper.html()).to.contain('span')
}
)

itDoNotRunIf(
vueVersion < 2.5 || mountingMethod.name !== 'mount',
'resolves v-model directive',
() => {
const wrapper = mountingMethod(
{
template: '<div><slot name="single" :text="text"></slot></div>',
data() {
return { text: 'text' }
}
},
{
scopedSlots: {
single: '<input v-model="props.text" type="text" />'
}
}
)

wrapper.find('input').setValue('abc')
expect(wrapper.find('input').element.value).to.equal('abc')
}
)
})

0 comments on commit a9eea7b

Please sign in to comment.