From 3769e8bca5cea5d2551034a8655d667086c3cfc6 Mon Sep 17 00:00:00 2001 From: Shubham Kanodia Date: Thu, 18 Apr 2019 23:27:22 +0530 Subject: [PATCH] [Docs] `debug`: Added documentation for `verbose` flag - also for `ignoreProps` flag --- docs/api/ReactWrapper/debug.md | 26 +++++++++++++++++++----- docs/api/ShallowWrapper/debug.md | 34 +++++++++++++++++++++++++++----- 2 files changed, 50 insertions(+), 10 deletions(-) diff --git a/docs/api/ReactWrapper/debug.md b/docs/api/ReactWrapper/debug.md index 3e8dc8b23..b6445bec0 100644 --- a/docs/api/ReactWrapper/debug.md +++ b/docs/api/ReactWrapper/debug.md @@ -31,7 +31,7 @@ function Bar() { return (
Non-Foo - +
); } @@ -44,13 +44,13 @@ console.log(mount().debug()); Would output the following to the console: -```jsx +```text
Non-Foo - +
Foo @@ -68,7 +68,7 @@ console.log(mount().find(Foo).debug()); ``` Would output the following to the console: -```jsx +```text
@@ -83,7 +83,7 @@ console.log(mount().find(Foo).debug({ ignoreProps: true })); ``` Would output the following to the console: -```jsx +```text
@@ -92,3 +92,19 @@ Would output the following to the console:
``` + +and: +```jsx +console.log(mount().find(Foo).debug({ verbose: true })); +``` +Would output the following to the console: + +```text + +
+ + Foo + +
+
+``` diff --git a/docs/api/ShallowWrapper/debug.md b/docs/api/ShallowWrapper/debug.md index 68ef624bd..4b4f17eda 100644 --- a/docs/api/ShallowWrapper/debug.md +++ b/docs/api/ShallowWrapper/debug.md @@ -8,6 +8,7 @@ console when tests are not passing when you expect them to. `options` (`Object` [optional]): - `options.ignoreProps`: (`Boolean` [optional]): Whether props should be omitted in the resulting string. Props are included by default. +- `options.verbose`: (`Boolean` [optional]): Whether arrays and objects passed as props should be verbosely printed. #### Returns @@ -21,7 +22,12 @@ function Book({ title, pages }) { return (

{title}

- {pages && } + {pages && ( + + )}
); } @@ -56,8 +62,8 @@ console.log(wrapper.debug()); Outputs to console: ```text
-

Huckleberry Finn

- +

Huckleberry Finn

+
``` @@ -73,7 +79,25 @@ console.log(wrapper.debug({ ignoreProps: true })); Outputs to console: ```text
-

Huckleberry Finn

- +

Huckleberry Finn

+ +
+``` + + +```jsx +const wrapper = shallow(( + +)); +console.log(wrapper.debug({ verbose: true })); +``` +Outputs to console: +```text +
+

Huckleberry Finn

+
```