Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync docs with v1.0 #1538

Merged
merged 5 commits into from May 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
@@ -1,9 +1,10 @@
# 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)

Vue Test Utils is the official testing library for Vue.js.

## Packages

This repository provides the following two packages.
They are currently in beta.
This repository provides the following two packages:

- [Vue Test Utils](./packages/test-utils)
- [Vue Server Test Utils](./packages/server-test-utils)
Expand Down
14 changes: 0 additions & 14 deletions RELEASE_NOTE_1.0.0-beta.33.md

This file was deleted.

33 changes: 16 additions & 17 deletions docs/api/options.md
Expand Up @@ -302,8 +302,7 @@ remove the rendered elements from the document and destroy the component instanc

```js
const Component = {
template: '<div>ABC</div>',
props: ['msg']
template: '<div>ABC</div>'
}
let wrapper = mount(Component, {
attachTo: '#root'
Expand All @@ -323,7 +322,11 @@ wrapper.destroy()
- type: `boolean`
- default: `false`

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).
::: warning
`attachToDocument` is deprecated and will be removed in future releases. Use [`attachTo`](#attachto) instead.
:::

Like [`attachTo`](#attachto), but automatically creates a new `div` element for you and inserts it into the body.

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

```js
const Component = {
template: '<div>{{ foo() }}{{ bar() }}{{ baz() }}</div>',
methods: {
foo() {
return 'a'
},
bar() {
return 'b'
template: '<div>{{ foo }}</div>',
data() {
return {
foo: 'fromComponent'
}
}
}
const options = {
methods: {
bar() {
return 'B'
},
baz() {
return 'C'
data() {
return {
foo: 'fromOptions'
}
}
}

const wrapper = mount(Component, options)
expect(wrapper.text()).toBe('aBC')

expect(wrapper.text()).toBe('fromOptions')
```
8 changes: 8 additions & 0 deletions docs/api/wrapper-array/isEmpty.md
@@ -1,5 +1,13 @@
## isEmpty

::: warning
`isEmpty` is deprecated and will be removed in future releases.

Consider a custom matcher such as those provided in [jest-dom](https://github.com/testing-library/jest-dom#tobeempty).

When using with findComponent, access the DOM element with findComponent(Comp).element
:::

Assert every `Wrapper` in `WrapperArray` does not contain child node.

- **Returns:** `{boolean}`
Expand Down
4 changes: 4 additions & 0 deletions docs/api/wrapper-array/isVueInstance.md
@@ -1,5 +1,9 @@
## isVueInstance

::: warning
`isVueInstance` is deprecated and will be removed in future releases.
:::

Assert every `Wrapper` in `WrapperArray` is Vue instance.

- **Returns:** `{boolean}`
Expand Down
4 changes: 4 additions & 0 deletions docs/api/wrapper-array/setMethods.md
@@ -1,5 +1,9 @@
## setMethods

::: warning
`setMethods` is deprecated and will be removed in future releases.
:::

Sets `Wrapper` `vm` methods and forces update on each `Wrapper` in `WrapperArray`.

**Note every `Wrapper` must contain a Vue instance.**
Expand Down
6 changes: 6 additions & 0 deletions docs/api/wrapper/emittedByOrder.md
@@ -1,5 +1,11 @@
## emittedByOrder

::: warning
`emittedByOrder` is deprecated and will be removed in future releases.

Use `wrapper.emitted` instead.
:::

Return an Array containing custom events emitted by the `Wrapper` `vm`.

- **Returns:** `Array<{ name: string, args: Array<any> }>`
Expand Down
4 changes: 4 additions & 0 deletions docs/api/wrapper/find.md
@@ -1,5 +1,9 @@
## find

::: warning
Using `find` to search for a Component is deprecated and will be removed. Use `findComponent` instead.
:::

Returns `Wrapper` of first DOM node or Vue component matching selector.

Use any valid DOM selector (uses `querySelector` syntax).
Expand Down
8 changes: 7 additions & 1 deletion docs/api/wrapper/findAll.md
@@ -1,5 +1,9 @@
## findAll

::: warning
Using `findAll` to search for Components is deprecated and will be removed. Use `findAllComponents` instead.
:::

Returns a [`WrapperArray`](../wrapper-array/).

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

const wrapper = mount(Foo)

const div = wrapper.findAll('div').at(0)
expect(div.is('div')).toBe(true)
const bar = wrapper.findAll(Bar).at(0)

const bar = wrapper.findAll(Bar).at(0) // Deprecated usage
expect(bar.is(Bar)).toBe(true)
```
8 changes: 8 additions & 0 deletions docs/api/wrapper/isEmpty.md
@@ -1,5 +1,13 @@
## isEmpty

::: warning
`isEmpty` is deprecated and will be removed in future releases.

Consider a custom matcher such as those provided in [jest-dom](https://github.com/testing-library/jest-dom#tobeempty).

When using with findComponent, access the DOM element with `findComponent(Comp).element`
:::

Assert `Wrapper` does not contain child node.

- **Returns:** `{boolean}`
Expand Down
8 changes: 8 additions & 0 deletions docs/api/wrapper/isVisible.md
@@ -1,5 +1,13 @@
## isVisible

::: warning
`isVisible` is deprecated and will be removed in future releases.

Consider a custom matcher such as those provided in [jest-dom](https://github.com/testing-library/jest-dom#tobevisible).

When using with findComponent, access the DOM element with `findComponent(Comp).element`
:::

Assert `Wrapper` is visible.

Returns `false` if an ancestor element has `display: none` or `visibility: hidden` style.
Expand Down
4 changes: 4 additions & 0 deletions docs/api/wrapper/isVueInstance.md
@@ -1,5 +1,9 @@
## isVueInstance

::: warning
`isVueInstance` is deprecated and will be removed in future releases.
:::

Assert `Wrapper` is Vue instance.

- **Returns:** `{boolean}`
Expand Down
4 changes: 4 additions & 0 deletions docs/api/wrapper/name.md
@@ -1,5 +1,9 @@
## name

::: warning
`name` is deprecated and will be removed in future releases.
:::

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.

- **Returns:** `{string}`
Expand Down
4 changes: 4 additions & 0 deletions docs/api/wrapper/overview.md
@@ -1,5 +1,9 @@
## overview

::: warning
`overview` is deprecated and will be removed in future releases.
:::

Prints a simple overview of the `Wrapper`.

- **Example:**
Expand Down
4 changes: 4 additions & 0 deletions docs/api/wrapper/setMethods.md
@@ -1,5 +1,9 @@
## setMethods

::: warning
`setMethods` is deprecated and will be removed in future releases.
:::

Sets `Wrapper` `vm` methods and forces update.

**Note the Wrapper must contain a Vue instance.**
Expand Down