Skip to content

Commit 5207bb7

Browse files
committed
update docs
1 parent 0235d60 commit 5207bb7

File tree

4 files changed

+27
-11
lines changed

4 files changed

+27
-11
lines changed

docs/api/ReactWrapper/exists.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
1-
# `.exists() => Boolean`
1+
# `.exists([selector]) => Boolean`
2+
3+
Returns whether or not the current node exists. Or, if a selector is passed in, whether that selector has any matching results.
4+
5+
6+
7+
#### Arguments
8+
9+
1. `selector` ([`EnzymeSelector`](../selector.md) [optional]): The selector to check existence for.
210

3-
Returns whether or not the current node exists.
411

512

613
#### Returns
714

8-
`Boolean`: whether or not the current node exists.
15+
`Boolean`: whether or not the current node exists, or the selector had any results.
916

1017

1118

@@ -14,5 +21,6 @@ Returns whether or not the current node exists.
1421

1522
```jsx
1623
const wrapper = mount(<div className="some-class" />);
24+
expect(wrapper.exists('.some-class')).to.equal(true);
1725
expect(wrapper.find('.other-class').exists()).to.equal(false);
1826
```

docs/api/ShallowWrapper/exists.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
1-
# `.exists() => Boolean`
1+
# `.exists([selector]) => Boolean`
2+
3+
Returns whether or not the current node exists. Or, if a selector is passed in, whether that selector has any matching results.
4+
5+
6+
7+
#### Arguments
8+
9+
1. `selector` ([`EnzymeSelector`](../selector.md) [optional]): The selector to check existence for.
210

3-
Returns whether or not the current node exists.
411

512

613
#### Returns
714

8-
`Boolean`: whether or not the current node exists.
15+
`Boolean`: whether or not the current node exists, or the selector had any results.
916

1017

1118

1219
#### Example
1320

1421

1522
```jsx
16-
const wrapper = shallow(<div className="some-class" />);
23+
const wrapper = mount(<div className="some-class" />);
24+
expect(wrapper.exists('.some-class')).to.equal(true);
1725
expect(wrapper.find('.other-class').exists()).to.equal(false);
1826
```

docs/api/mount.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ Returns whether or not the current root node has the given class name or not.
9090
#### [`.is(selector) => Boolean`](ReactWrapper/is.md)
9191
Returns whether or not the current node matches a provided selector.
9292

93-
#### [`.exists() => Boolean`](ReactWrapper/exists.md)
94-
Returns whether or not the current node exists.
93+
#### [`.exists([selector]) => Boolean`](ReactWrapper/exists.md)
94+
Returns whether or not the current node exists, or, if given a selector, whether that selector has any matching results.
9595

9696
#### [`.isEmpty() => Boolean`](ReactWrapper/isEmpty.md)
9797
*Deprecated*: Use [.exists()](ReactWrapper/exists.md) instead.

docs/api/shallow.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ Returns whether or not the current node has the given class name or not.
9797
#### [`.is(selector) => Boolean`](ShallowWrapper/is.md)
9898
Returns whether or not the current node matches a provided selector.
9999

100-
#### [`.exists() => Boolean`](ShallowWrapper/exists.md)
101-
Returns whether or not the current node exists.
100+
#### [`.exists([selector]) => Boolean`](ShallowWrapper/exists.md)
101+
Returns whether or not the current node exists, or, if given a selector, whether that selector has any matching results.
102102

103103
#### [`.isEmpty() => Boolean`](ShallowWrapper/isEmpty.md)
104104
*Deprecated*: Use [.exists()](ShallowWrapper/exists.md) instead.

0 commit comments

Comments
 (0)