Skip to content

Commit a956468

Browse files
authored
docs: add WrapperArray#exists docs (#1795)
1 parent 30e5bc3 commit a956468

File tree

4 files changed

+23
-5
lines changed

4 files changed

+23
-5
lines changed

docs/api/wrapper-array/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ A `WrapperArray` is an object that contains an array of [`Wrappers`](../wrapper/
1717
!!!include(docs/api/wrapper-array/at.md)!!!
1818
!!!include(docs/api/wrapper-array/contains.md)!!!
1919
!!!include(docs/api/wrapper-array/destroy.md)!!!
20+
!!!include(docs/api/wrapper-array/exists.md)!!!
2021
!!!include(docs/api/wrapper-array/filter.md)!!!
2122
!!!include(docs/api/wrapper-array/is.md)!!!
2223
!!!include(docs/api/wrapper-array/isEmpty.md)!!!

docs/api/wrapper-array/exists.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## exists
2+
3+
Assert `WrapperArray` exists.
4+
5+
Returns false if called on a `WrapperArray` with no `Wrapper` objects, or if
6+
any of them do not exist.
7+
8+
- **Returns:** `{boolean}`
9+
10+
- **Example:**
11+
12+
```js
13+
import { mount } from '@vue/test-utils'
14+
import Foo from './Foo.vue'
15+
16+
const wrapper = mount(Foo)
17+
expect(wrapper.findAll('div').exists()).toBe(true)
18+
expect(wrapper.findAll('does-not-exist').exists()).toBe(false)
19+
```

docs/api/wrapper/exists.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
## exists
22

3-
Assert `Wrapper` or `WrapperArray` exists.
3+
Assert `Wrapper` exists.
44

5-
Returns false if called on an empty `Wrapper` or `WrapperArray`.
5+
Returns false if called on a `Wrapper` which does not exist.
66

77
- **Returns:** `{boolean}`
88

@@ -15,6 +15,4 @@ import Foo from './Foo.vue'
1515
const wrapper = mount(Foo)
1616
expect(wrapper.exists()).toBe(true)
1717
expect(wrapper.find('does-not-exist').exists()).toBe(false)
18-
expect(wrapper.findAll('div').exists()).toBe(true)
19-
expect(wrapper.findAll('does-not-exist').exists()).toBe(false)
2018
```

packages/test-utils/src/wrapper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export default class Wrapper implements BaseWrapper {
208208
}
209209

210210
/**
211-
* Utility to check wrapper exists. Returns true as Wrapper always exists
211+
* Utility to check wrapper exists.
212212
*/
213213
exists(): boolean {
214214
if (this.vm) {

0 commit comments

Comments
 (0)