Skip to content
Closed
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
35 changes: 33 additions & 2 deletions test/specs/mounting-options/slots.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ describeWithMountingMethods('options.slots', mountingMethod => {
}
})

it('mounts component with text slot', () => {
it('mounts component with named and default text slot', () => {
const wrapper = mountingMethod(ComponentWithSlots, {
slots: {
default: 'hello,',
Expand All @@ -235,7 +235,20 @@ describeWithMountingMethods('options.slots', mountingMethod => {
}
})

it('mounts functional component with text slot', () => {
it('mounts component with named text slot', () => {
const wrapper = mountingMethod(ComponentWithSlots, {
slots: {
header: 'world'
}
})
if (mountingMethod.name === 'renderToString') {
expect(wrapper).contains('world')
} else {
expect(wrapper.text()).to.contain('world')
}
})

it('mounts functional component with named and default text slot', () => {
const TestComponent = {
name: 'component-with-slots',
functional: true,
Expand All @@ -254,6 +267,24 @@ describeWithMountingMethods('options.slots', mountingMethod => {
}
})

it('mounts functional component with named text slot', () => {
const TestComponent = {
name: 'component-with-slots',
functional: true,
render: (h, ctx) => h('div', ctx.data, [ctx.slots().header])
}
const wrapper = mountingMethod(TestComponent, {
slots: {
header: 'world'
}
})
if (mountingMethod.name === 'renderToString') {
expect(wrapper).contains('world')
} else {
expect(wrapper.text()).to.contain('world')
}
})

it('mounts component with named slot if passed component in slot object', () => {
const wrapper = mountingMethod(ComponentWithSlots, {
slots: {
Expand Down