-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into Issue-1669-instanceDocs
- Loading branch information
Showing
80 changed files
with
2,445 additions
and
761 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
{ | ||
"presets": ["airbnb"], | ||
"plugins": [ | ||
["transform-replace-object-assign", "object.assign"], | ||
["transform-replace-object-assign", { "moduleSpecifier": "object.assign" }], | ||
], | ||
ignore: [ | ||
"packages/enzyme-test-suite/test/_helpers/untranspiled*", | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
language: node_js | ||
node_js: | ||
- "10" | ||
- "8" | ||
- "6" | ||
- "4" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,51 @@ | ||
# `.type() => String|Function` | ||
# `.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 a 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. If it's `null`, it will be `null`. | ||
|
||
Note: can only be called on a wrapper of a single node. | ||
|
||
|
||
#### Returns | ||
|
||
`String|Function`: The type of the current node | ||
`String|Function|null`: The type of the current node | ||
|
||
|
||
|
||
#### Examples | ||
|
||
```jsx | ||
const wrapper = mount(<div />); | ||
function Foo() { | ||
return <div />; | ||
} | ||
const wrapper = mount(<Foo />); | ||
expect(wrapper.type()).to.equal('div'); | ||
``` | ||
|
||
```jsx | ||
function Foo() { | ||
return ( | ||
<div> | ||
<button type="button" className="btn">Button</button> | ||
</div> | ||
); | ||
} | ||
const wrapper = mount(<Foo />); | ||
expect(wrapper.find('.btn').type()).to.equal('button'); | ||
``` | ||
|
||
```jsx | ||
function Foo() { | ||
return <Bar />; | ||
} | ||
const wrapper = mount(<Foo />); | ||
expect(wrapper.type()).to.equal(Foo); | ||
expect(wrapper.type()).to.equal(Bar); | ||
``` | ||
|
||
```jsx | ||
function Null() { | ||
return null; | ||
} | ||
const wrapper = mount(<Null />); | ||
expect(wrapper.type()).to.equal(null); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.