From f2220eebea322701654766a799818f31835068f7 Mon Sep 17 00:00:00 2001 From: Lachlan Miller Date: Fri, 3 Jan 2020 17:08:56 +1000 Subject: [PATCH] (docs): add workaround regarding scoped slots --- docs/api/options.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/api/options.md b/docs/api/options.md index 4f676299e..2bf9d03f5 100644 --- a/docs/api/options.md +++ b/docs/api/options.md @@ -147,6 +147,27 @@ shallowMount(Component, { }) ``` +::: warning Root Element required +Due to the internal implementatioj of this feature, the slot content has to return a root element, even though a scoped slot is allowed to return an array of elements. + +If you ever need this in a test, the recommended workaround is to wrap the component under test in another component and mount that one: +::: + +```javascript +const WrapperComp = { + template: ` + +

Using the {{props.a}}

+

Using the {{props.a}}

+
+ `, + components: { + ComponentUnderTest + } +} +const wrapper = mount(WrapperComp).find(ComponentUnderTest) +``` + ## stubs - type: `{ [name: string]: Component | boolean } | Array`