Skip to content

Commit a23d35c

Browse files
committed
All GREEN, BABY
1 parent 4aab43e commit a23d35c

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,14 @@ export function createStubFromComponent(
9393
$_vueTestUtils_original: originalComponent,
9494
$_doNotStubChildren: true,
9595
render(h, context) {
96-
console.log('parent', this.$options.parent._vnode.data.scopedSlots.newSyntax())
96+
97+
const renderFns = this && this.$options &&
98+
this.$options.parent._vnode &&
99+
this.$options.parent._vnode.data &&
100+
this.$options.parent._vnode.data.scopedSlots &&
101+
Object.keys(this.$options.parent._vnode.data.scopedSlots).filter(x =>
102+
x[0] !== '_' && !x.includes('$')
103+
)
97104
return h(
98105
tagName,
99106
{
@@ -110,10 +117,11 @@ export function createStubFromComponent(
110117
...this.$props
111118
}
112119
},
113-
// this fucker passes
114-
[this.$options.parent._vnode.data.scopedSlots.newSyntax()] // .newSyntax
115-
116-
// context ? context.children : this.$options._renderChildren || this.$options.parent._vnode.data.scopedSlots // .newSyntax
120+
context
121+
? context.children
122+
: this.$options._renderChildren ||
123+
// support 2.6+ scopedSlots
124+
renderFns && renderFns.map(x => this.$options.parent._vnode.data.scopedSlots[x]())
117125
)
118126
}
119127
}

test/specs/shallow-mount.spec.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
110110
)
111111
})
112112

113-
it.only('renders named slots with v-slot syntax', () => {
113+
it('renders named slots with v-slot syntax', () => {
114114
const localVue = createLocalVue()
115115
localVue.component('Foo', {
116116
template: '<div><slot name="newSyntax" /></div>'
@@ -127,7 +127,6 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
127127
const wrapper = shallowMount(TestComponent, {
128128
localVue
129129
})
130-
131130
expect(wrapper.find({ name: 'Foo' }).exists()).to.equal(true)
132131
expect(wrapper.find('.new-example').exists()).to.equal(true)
133132
expect(wrapper.html()).to.equal(

0 commit comments

Comments
 (0)