Skip to content

Commit 085e014

Browse files
finnigantimeljharb
authored andcommitted
[Docs] add options arg to API docs for debug()
1 parent 6f7f4fb commit 085e014

File tree

2 files changed

+44
-2
lines changed

2 files changed

+44
-2
lines changed

docs/api/ReactWrapper/debug.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
# `.debug() => String`
1+
# `.debug([options]) => String`
22

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

66

7+
#### Arguments
8+
9+
`options` (`Object` [optional]):
10+
- `options.ignoreProps`: (`Boolean` [optional]): Whether props should be omitted in the resulting string. Props are included by default.
11+
712
#### Returns
813

914
`String`: The resulting string.
@@ -72,3 +77,18 @@ Would output the following to the console:
7277
</div>
7378
</Foo>
7479
```
80+
and:
81+
```jsx
82+
console.log(mount(<Bar id="2" />).find(Foo).debug({ ignoreProps: true }));
83+
```
84+
Would output the following to the console:
85+
<!-- eslint-disable -->
86+
```jsx
87+
<Foo>
88+
<div>
89+
<span>
90+
Foo
91+
</span>
92+
</div>
93+
</Foo>
94+
```

docs/api/ShallowWrapper/debug.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
# `.debug() => String`
1+
# `.debug([options]) => String`
22

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

66

7+
#### Arguments
8+
9+
`options` (`Object` [optional]):
10+
- `options.ignoreProps`: (`Boolean` [optional]): Whether props should be omitted in the resulting string. Props are included by default.
11+
712
#### Returns
813

914
`String`: The resulting string.
@@ -55,3 +60,20 @@ Outputs to console:
5560
<NumberOfPages pages="633 pages" />
5661
</div>
5762
```
63+
64+
```jsx
65+
const wrapper = shallow((
66+
<Book
67+
title="Huckleberry Finn"
68+
pages="633 pages"
69+
/>
70+
));
71+
console.log(wrapper.debug({ ignoreProps: true }));
72+
```
73+
Outputs to console:
74+
```text
75+
<div>
76+
<h1>Huckleberry Finn</h1>
77+
<NumberOfPages />
78+
</div>
79+
```

0 commit comments

Comments
 (0)