Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add null option to shallow type() comment & docs #1492

Merged
merged 1 commit into from
Jan 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/api/ReactWrapper/name.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# `.name() => String|null`

Returns the name of the current node of this wrapper. If it's a composite component, this will be
the name of the component. If it's native DOM node, it will be a string of the tag name. If it's
the name of the component. If it's a native DOM node, it will be a string of the tag name. If it's
`null`, it will be `null`.

The order of precedence on returning the name is: `type.displayName` -> `type.name` -> `type`.
Expand Down
2 changes: 1 addition & 1 deletion docs/api/ReactWrapper/type.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# `.type() => String|Function`

Returns the type of the current node of this wrapper. If it's a composite component, this will be
the component constructor. If it's native DOM node, it will be a string of the tag name.
the component constructor. If it's a native DOM node, it will be a string of the tag name.

Note: can only be called on a wrapper of a single node.

Expand Down
2 changes: 1 addition & 1 deletion docs/api/ShallowWrapper/name.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# `.name() => String|null`

Returns the name of the current node of this wrapper. If it's a composite component, this will be
the name of the top-most rendered component. If it's native DOM node, it will be a string of the
the name of the top-most rendered component. If it's a native DOM node, it will be a string of the
tag name. If it's `null`, it will be `null`.

The order of precedence on returning the name is: `type.displayName` -> `type.name` -> `type`.
Expand Down
2 changes: 1 addition & 1 deletion docs/api/ShallowWrapper/type.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# `.type() => String|Function|null`

Returns the type of the current node of this wrapper. If it's a composite component, this will be
the component constructor. If it's native DOM node, it will be a string of the tag name. If it's `null`, it will be `null`.
the component constructor. If it's a native DOM node, it will be a string of the tag name. If it's `null`, it will be `null`.

Note: can only be called on a wrapper of a single node.

Expand Down
2 changes: 1 addition & 1 deletion docs/api/shallow.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ Calls `.forceUpdate()` on the root component instance.
#### [`.debug() => String`](ShallowWrapper/debug.md)
Returns a string representation of the current shallow render tree for debugging purposes.

#### [`.type() => String|Function`](ShallowWrapper/type.md)
#### [`.type() => String|Function|null`](ShallowWrapper/type.md)
Returns the type of the current node of the wrapper.

#### [`.name() => String`](ShallowWrapper/name.md)
Expand Down
5 changes: 3 additions & 2 deletions packages/enzyme/src/ShallowWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -852,9 +852,10 @@ class ShallowWrapper {

/**
* Returns the type of the current node of this wrapper. If it's a composite component, this will
* be the component constructor. If it's a native DOM node, it will be a string.
* be the component constructor. If it's a native DOM node, it will be a string of the tag name.
* If it's null, it will be null.
*
* @returns {String|Function}
* @returns {String|Function|null}
*/
type() {
return this.single('type', typeOfNode);
Expand Down