Skip to content

Commit 26db1f6

Browse files
authored
docs(vue-testing-library): add slot usage examples (#1516)
1 parent 6d22ed7 commit 26db1f6

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

docs/vue-testing-library/api.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,24 @@ Vue Router is passed, it will be used.
7878

7979
It will be merged with `propsData`.
8080

81+
##### `slots` (`Object`)
82+
83+
Used to provide slot content when rendering the component. Keys are slot names,
84+
and values can be strings, template snippets, or components, similar to how
85+
[slots](https://test-utils.vuejs.org/api/#slots) are defined in Vue Test Utils.
86+
87+
For example:
88+
89+
```js
90+
render(MyComponent, {
91+
slots: {
92+
default: 'Default',
93+
first: h('h1', {}, 'Named Slot'),
94+
second: Bar
95+
},
96+
})
97+
```
98+
8199
##### `container` (`HTMLElement`)
82100

83101
By default, `Vue Testing Library` will create a `div` and append it to the

0 commit comments

Comments
 (0)