Skip to content

Commit 44ac570

Browse files
authored
Sync docs with v1.0 (#1538)
* docs: add warnings on deprecated methods * docs: remove unused prop * docs: add deprecation warning on attachToDocument * docs: remove beta from readme * chore: remove beta.33 release file
1 parent 6e941b6 commit 44ac570

15 files changed

+84
-34
lines changed

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# Vue Test Utils [![Build Status](https://circleci.com/gh/vuejs/vue-test-utils/tree/dev.png?style=shield)](https://circleci.com/gh/vuejs/vue-test-utils)
22

3+
Vue Test Utils is the official testing library for Vue.js.
4+
35
## Packages
46

5-
This repository provides the following two packages.
6-
They are currently in beta.
7+
This repository provides the following two packages:
78

89
- [Vue Test Utils](./packages/test-utils)
910
- [Vue Server Test Utils](./packages/server-test-utils)

RELEASE_NOTE_1.0.0-beta.33.md

-14
This file was deleted.

docs/api/options.md

+16-17
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,7 @@ remove the rendered elements from the document and destroy the component instanc
302302

303303
```js
304304
const Component = {
305-
template: '<div>ABC</div>',
306-
props: ['msg']
305+
template: '<div>ABC</div>'
307306
}
308307
let wrapper = mount(Component, {
309308
attachTo: '#root'
@@ -323,7 +322,11 @@ wrapper.destroy()
323322
- type: `boolean`
324323
- default: `false`
325324

326-
Like [`attachTo`](#attachto), but automatically creates a new `div` element for you and inserts it into the body. This is deprecated in favor of [`attachTo`](#attachto).
325+
::: warning
326+
`attachToDocument` is deprecated and will be removed in future releases. Use [`attachTo`](#attachto) instead.
327+
:::
328+
329+
Like [`attachTo`](#attachto), but automatically creates a new `div` element for you and inserts it into the body.
327330

328331
When attaching to the DOM, you should call `wrapper.destroy()` at the end of your test to
329332
remove the rendered elements from the document and destroy the component instance.
@@ -432,26 +435,22 @@ When the options for `mount` and `shallowMount` contain the options other than t
432435

433436
```js
434437
const Component = {
435-
template: '<div>{{ foo() }}{{ bar() }}{{ baz() }}</div>',
436-
methods: {
437-
foo() {
438-
return 'a'
439-
},
440-
bar() {
441-
return 'b'
438+
template: '<div>{{ foo }}</div>',
439+
data() {
440+
return {
441+
foo: 'fromComponent'
442442
}
443443
}
444444
}
445445
const options = {
446-
methods: {
447-
bar() {
448-
return 'B'
449-
},
450-
baz() {
451-
return 'C'
446+
data() {
447+
return {
448+
foo: 'fromOptions'
452449
}
453450
}
454451
}
452+
455453
const wrapper = mount(Component, options)
456-
expect(wrapper.text()).toBe('aBC')
454+
455+
expect(wrapper.text()).toBe('fromOptions')
457456
```

docs/api/wrapper-array/isEmpty.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
## isEmpty
22

3+
::: warning
4+
`isEmpty` is deprecated and will be removed in future releases.
5+
6+
Consider a custom matcher such as those provided in [jest-dom](https://github.com/testing-library/jest-dom#tobeempty).
7+
8+
When using with findComponent, access the DOM element with findComponent(Comp).element
9+
:::
10+
311
Assert every `Wrapper` in `WrapperArray` does not contain child node.
412

513
- **Returns:** `{boolean}`

docs/api/wrapper-array/isVueInstance.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## isVueInstance
22

3+
::: warning
4+
`isVueInstance` is deprecated and will be removed in future releases.
5+
:::
6+
37
Assert every `Wrapper` in `WrapperArray` is Vue instance.
48

59
- **Returns:** `{boolean}`

docs/api/wrapper-array/setMethods.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## setMethods
22

3+
::: warning
4+
`setMethods` is deprecated and will be removed in future releases.
5+
:::
6+
37
Sets `Wrapper` `vm` methods and forces update on each `Wrapper` in `WrapperArray`.
48

59
**Note every `Wrapper` must contain a Vue instance.**

docs/api/wrapper/emittedByOrder.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
## emittedByOrder
22

3+
::: warning
4+
`emittedByOrder` is deprecated and will be removed in future releases.
5+
6+
Use `wrapper.emitted` instead.
7+
:::
8+
39
Return an Array containing custom events emitted by the `Wrapper` `vm`.
410

511
- **Returns:** `Array<{ name: string, args: Array<any> }>`

docs/api/wrapper/find.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## find
22

3+
::: warning
4+
Using `find` to search for a Component is deprecated and will be removed. Use `findComponent` instead.
5+
:::
6+
37
Returns `Wrapper` of first DOM node or Vue component matching selector.
48

59
Use any valid DOM selector (uses `querySelector` syntax).

docs/api/wrapper/findAll.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## findAll
22

3+
::: warning
4+
Using `findAll` to search for Components is deprecated and will be removed. Use `findAllComponents` instead.
5+
:::
6+
37
Returns a [`WrapperArray`](../wrapper-array/).
48

59
Use any valid [selector](../selectors.md).
@@ -18,8 +22,10 @@ import Foo from './Foo.vue'
1822
import Bar from './Bar.vue'
1923

2024
const wrapper = mount(Foo)
25+
2126
const div = wrapper.findAll('div').at(0)
2227
expect(div.is('div')).toBe(true)
23-
const bar = wrapper.findAll(Bar).at(0)
28+
29+
const bar = wrapper.findAll(Bar).at(0) // Deprecated usage
2430
expect(bar.is(Bar)).toBe(true)
2531
```

docs/api/wrapper/isEmpty.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
## isEmpty
22

3+
::: warning
4+
`isEmpty` is deprecated and will be removed in future releases.
5+
6+
Consider a custom matcher such as those provided in [jest-dom](https://github.com/testing-library/jest-dom#tobeempty).
7+
8+
When using with findComponent, access the DOM element with `findComponent(Comp).element`
9+
:::
10+
311
Assert `Wrapper` does not contain child node.
412

513
- **Returns:** `{boolean}`

docs/api/wrapper/isVisible.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
## isVisible
22

3+
::: warning
4+
`isVisible` is deprecated and will be removed in future releases.
5+
6+
Consider a custom matcher such as those provided in [jest-dom](https://github.com/testing-library/jest-dom#tobevisible).
7+
8+
When using with findComponent, access the DOM element with `findComponent(Comp).element`
9+
:::
10+
311
Assert `Wrapper` is visible.
412

513
Returns `false` if an ancestor element has `display: none` or `visibility: hidden` style.

docs/api/wrapper/isVueInstance.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## isVueInstance
22

3+
::: warning
4+
`isVueInstance` is deprecated and will be removed in future releases.
5+
:::
6+
37
Assert `Wrapper` is Vue instance.
48

59
- **Returns:** `{boolean}`

docs/api/wrapper/name.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## name
22

3+
::: warning
4+
`name` is deprecated and will be removed in future releases.
5+
:::
6+
37
Returns component name if `Wrapper` contains a Vue instance, or the tag name of `Wrapper` DOM node if `Wrapper` does not contain a Vue instance.
48

59
- **Returns:** `{string}`

docs/api/wrapper/overview.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## overview
22

3+
::: warning
4+
`overview` is deprecated and will be removed in future releases.
5+
:::
6+
37
Prints a simple overview of the `Wrapper`.
48

59
- **Example:**

docs/api/wrapper/setMethods.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## setMethods
22

3+
::: warning
4+
`setMethods` is deprecated and will be removed in future releases.
5+
:::
6+
37
Sets `Wrapper` `vm` methods and forces update.
48

59
**Note the Wrapper must contain a Vue instance.**

0 commit comments

Comments
 (0)