Skip to content

Commit

Permalink
[Docs] add options arg to API docs for debug()
Browse files Browse the repository at this point in the history
  • Loading branch information
finnigantime authored and ljharb committed Jan 28, 2018
1 parent 6f7f4fb commit 085e014
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
22 changes: 21 additions & 1 deletion docs/api/ReactWrapper/debug.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# `.debug() => String`
# `.debug([options]) => String`

Returns an HTML-like string of the wrapper for debugging purposes. Useful to print out to the
console when tests are not passing when you expect them to.


#### Arguments

`options` (`Object` [optional]):
- `options.ignoreProps`: (`Boolean` [optional]): Whether props should be omitted in the resulting string. Props are included by default.

#### Returns

`String`: The resulting string.
Expand Down Expand Up @@ -72,3 +77,18 @@ Would output the following to the console:
</div>
</Foo>
```
and:
```jsx
console.log(mount(<Bar id="2" />).find(Foo).debug({ ignoreProps: true }));
```
Would output the following to the console:
<!-- eslint-disable -->
```jsx
<Foo>
<div>
<span>
Foo
</span>
</div>
</Foo>
```
24 changes: 23 additions & 1 deletion docs/api/ShallowWrapper/debug.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# `.debug() => String`
# `.debug([options]) => String`

Returns an HTML-like string of the wrapper for debugging purposes. Useful to print out to the
console when tests are not passing when you expect them to.


#### Arguments

`options` (`Object` [optional]):
- `options.ignoreProps`: (`Boolean` [optional]): Whether props should be omitted in the resulting string. Props are included by default.

#### Returns

`String`: The resulting string.
Expand Down Expand Up @@ -55,3 +60,20 @@ Outputs to console:
<NumberOfPages pages="633 pages" />
</div>
```

```jsx
const wrapper = shallow((
<Book
title="Huckleberry Finn"
pages="633 pages"
/>
));
console.log(wrapper.debug({ ignoreProps: true }));
```
Outputs to console:
```text
<div>
<h1>Huckleberry Finn</h1>
<NumberOfPages />
</div>
```

0 comments on commit 085e014

Please sign in to comment.