diff --git a/test/specs/mounting-options/slots.spec.js b/test/specs/mounting-options/slots.spec.js index d0e769312..73852c7fd 100644 --- a/test/specs/mounting-options/slots.spec.js +++ b/test/specs/mounting-options/slots.spec.js @@ -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,', @@ -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, @@ -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: {