Skip to content

Commit b9d6941

Browse files
committed
chore: tweaks based on comments
1 parent 7b8e1d7 commit b9d6941

File tree

2 files changed

+6
-53
lines changed

2 files changed

+6
-53
lines changed

docs/vue-testing-library/api.mdx

+6-9
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ It also exposes these methods:
1515
- [`...queries`](#queries)
1616
- [`container`](#container)
1717
- [`baseElement`](#baseelement)
18-
- [`debug`](#debug)
18+
- [`debug`](#debugelement)
1919
- [`unmount`](#unmount)
2020
- [`html`](#html)
2121
- [`emitted`](#emitted)
@@ -32,19 +32,19 @@ It also exposes these methods:
3232
The `render` function is the only way of rendering components in Vue Testing
3333
Library.
3434

35-
It takes up to 3 parameters and returns an object with some helper methods.
35+
It takes up to 2 parameters and returns an object with some helper methods.
3636

3737
```js
3838
function render(Component, options, callbackFunction) {
3939
return {
4040
...DOMTestingLibraryQueries,
4141
container,
4242
baseElement,
43-
debug,
43+
debug(element),
4444
unmount,
4545
html,
4646
emitted,
47-
rerender,
47+
rerender(props),
4848
}
4949
}
5050
```
@@ -147,7 +147,7 @@ renders its HTML directly in the body.
147147
> Note: the queries returned by the `render` looks into `baseElement`, so you
148148
> can use queries to test your portal component without the `baseElement`.
149149
150-
#### `debug`
150+
#### `debug(element)`
151151

152152
This method is a shortcut for `console.log(prettyDOM(element))`.
153153

@@ -186,13 +186,10 @@ An alias for `@vue/test-utils`
186186
#### `rerender(props)`
187187

188188
An alias for `@vue/test-utils`
189-
[setProps](https://vue-test-utils.vuejs.org/api/wrapper/#setprops).
189+
[setProps](https://test-utils.vuejs.org/api/#setprops).
190190

191191
It returns a Promise through so you can `await rerender(...)`.
192192

193-
See
194-
[update properties example](vue-testing-library/examples.mdx#example-updating-properties).
195-
196193
---
197194

198195
## `fireEvent`

docs/vue-testing-library/examples.mdx

-44
Original file line numberDiff line numberDiff line change
@@ -50,50 +50,6 @@ test('increments value on click', async () => {
5050
})
5151
```
5252

53-
## Example updating properties:
54-
55-
```html
56-
<template>
57-
<div>
58-
<p>The sky is {{ sky }}</p>
59-
<p>And the grass is {{ grass }}</p>
60-
</div>
61-
</template>
62-
63-
<script>
64-
export default {
65-
props: {
66-
sky: {type: String, default: 'green'},
67-
grass: {type: String, default: 'blue'},
68-
},
69-
}
70-
</script>
71-
```
72-
73-
```js
74-
import {render} from '@testing-library/vue'
75-
import Component from './Component.vue'
76-
77-
test('properly handles property updates', async () => {
78-
const {getByText, rerender} = render(Component, {
79-
props: {
80-
sky: 'green',
81-
grass: 'blue',
82-
},
83-
})
84-
85-
// Asserts initial state.
86-
getByText('The sky is green')
87-
getByText('And the grass is blue')
88-
89-
await rerender({sky: 'Aquamarine'})
90-
91-
// Asserts updated state
92-
getByText('The sky is Aquamarine')
93-
getByText('And the grass is blue')
94-
})
95-
```
96-
9753
## Example using `v-model`:
9854

9955
```html

0 commit comments

Comments
 (0)