Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
krawaller committed Jun 29, 2018
1 parent d8bb24f commit 1d801c1
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 11 deletions.
14 changes: 11 additions & 3 deletions docs/api/ReactWrapper/exists.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
# `.exists() => Boolean`
# `.exists([selector]) => Boolean`

Returns whether or not the current node exists. Or, if a selector is passed in, whether that selector has any matching results.



#### Arguments

1. `selector` ([`EnzymeSelector`](../selector.md) [optional]): The selector to check existence for.

Returns whether or not the current node exists.


#### Returns

`Boolean`: whether or not the current node exists.
`Boolean`: whether or not the current node exists, or the selector had any results.



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

```jsx
const wrapper = mount(<div className="some-class" />);
expect(wrapper.exists('.some-class')).to.equal(true);
expect(wrapper.find('.other-class').exists()).to.equal(false);
```
16 changes: 12 additions & 4 deletions docs/api/ShallowWrapper/exists.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
# `.exists() => Boolean`
# `.exists([selector]) => Boolean`

Returns whether or not the current node exists. Or, if a selector is passed in, whether that selector has any matching results.



#### Arguments

1. `selector` ([`EnzymeSelector`](../selector.md) [optional]): The selector to check existence for.

Returns whether or not the current node exists.


#### Returns

`Boolean`: whether or not the current node exists.
`Boolean`: whether or not the current node exists, or the selector had any results.



#### Example


```jsx
const wrapper = shallow(<div className="some-class" />);
const wrapper = mount(<div className="some-class" />);
expect(wrapper.exists('.some-class')).to.equal(true);
expect(wrapper.find('.other-class').exists()).to.equal(false);
```
4 changes: 2 additions & 2 deletions docs/api/mount.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ Returns whether or not the current root node has the given class name or not.
#### [`.is(selector) => Boolean`](ReactWrapper/is.md)
Returns whether or not the current node matches a provided selector.

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

#### [`.isEmpty() => Boolean`](ReactWrapper/isEmpty.md)
*Deprecated*: Use [.exists()](ReactWrapper/exists.md) instead.
Expand Down
4 changes: 2 additions & 2 deletions docs/api/shallow.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ Returns whether or not the current node has the given class name or not.
#### [`.is(selector) => Boolean`](ShallowWrapper/is.md)
Returns whether or not the current node matches a provided selector.

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

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

0 comments on commit 1d801c1

Please sign in to comment.