Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v-bind object should not override props on scopedSlots #5995

Merged
merged 2 commits into from
Jun 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/core/instance/render-helpers/render-slot.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function renderSlot (
if (scopedSlotFn) { // scoped slot
props = props || {}
if (bindObject) {
extend(props, bindObject)
props = extend(extend({}, bindObject), props)
}
return scopedSlotFn(props) || fallback
} else {
Expand Down
10 changes: 5 additions & 5 deletions test/unit/features/component/component-scoped-slot.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('Component scoped slot', () => {
template: `
<test ref="test">
<template scope="props">
<span>{{ props.msg }} {{ props.msg2 }}</span>
<span>{{ props.msg }} {{ props.msg2 }} {{ props.msg3 }}</span>
</template>
</test>
`,
Expand All @@ -45,23 +45,23 @@ describe('Component scoped slot', () => {
data () {
return {
msg: 'hello',
obj: { msg2: 'world' }
obj: { msg2: 'world', msg3: '.' }
}
},
template: `
<div>
<slot :msg="msg" v-bind="obj"></slot>
<slot :msg="msg" v-bind="obj" msg3="!"></slot>
</div>
`
}
}
}).$mount()

expect(vm.$el.innerHTML).toBe('<span>hello world</span>')
expect(vm.$el.innerHTML).toBe('<span>hello world !</span>')
vm.$refs.test.msg = 'bye'
vm.$refs.test.obj.msg2 = 'bye'
waitForUpdate(() => {
expect(vm.$el.innerHTML).toBe('<span>bye bye</span>')
expect(vm.$el.innerHTML).toBe('<span>bye bye !</span>')
}).then(done)
})

Expand Down