OSDN Git Service

Regular updates
[twpd/master.git] / enzyme.md
index b0cf7d2..d5919b7 100644 (file)
--- a/enzyme.md
+++ b/enzyme.md
@@ -2,7 +2,7 @@
 title: Enzyme
 category: React
 layout: 2017/sheet
-updated: 2018-04-27
+updated: 2020-02-12
 tags: [Featured]
 weight: -1
 keywords:
@@ -11,12 +11,17 @@ keywords:
   - wrap.setProps()
   - "wrap.find().simulate('click')"
   - "wrap.contains(<div/>)"
-intro: |
-  [Enzyme](http://airbnb.io/enzyme) lets you write unit tests for React components. This guide covers Enzyme 3.x.
 ---
 
 ## Getting started
 
+### Introduction
+{: .-intro}
+
+[Enzyme](https://airbnb.io/enzyme) lets you write unit tests for React components. This guide covers Enzyme 3.x.
+
+- [Enzyme website](https://enzymejs.github.io/enzyme/) _(enzymejs.github.io)_
+
 ### Mounting
 {: .-prime}
 
@@ -36,8 +41,8 @@ wrap = mount(<MyComponent />)
 Shallow wrapping doesn't descend down to sub-components.
 A full mount also mounts sub-components.
 
-See: [Shallow rendering](http://airbnb.io/enzyme/docs/api/shallow.html),
-[Full rendering](http://airbnb.io/enzyme/docs/api/mount.html)
+See: [Shallow rendering](https://airbnb.io/enzyme/docs/api/shallow.html),
+[Full rendering](https://airbnb.io/enzyme/docs/api/mount.html)
 
 ### Debugging
 
@@ -47,7 +52,7 @@ console.log(wrap.debug())
 
 Shows HTML for debugging purposes.
 
-See: [debug()](http://airbnb.io/enzyme/docs/api/ReactWrapper/debug.html)
+See: [debug()](https://airbnb.io/enzyme/docs/api/ReactWrapper/debug.html)
 
 ## Examples
 {: .-three-column}
@@ -83,12 +88,12 @@ wrap.setState({ show: true })
 #### Asserting
 
 ```js
-expect(wrap.props('name')).toEqual('Moe')
+expect(wrap.prop('name')).toEqual('Moe')
 expect(wrap.state('show')).toEqual(true)
 ```
 
 ```js
-expect('name' in wrap.props()).toEqual(true)
+expect('name' in wrap.props()).toEqual('Moe')
 expect('show' in wrap.state()).toEqual(true)
 ```
 
@@ -168,7 +173,7 @@ Enzyme.configure({ adapter: new Adapter() })
 
 This configures Enzyme for React v16, and Jest to automatically configure Enzyme for you. There are other adapters in Enzyme's installation instructions.
 
-See: [Installation](http://airbnb.io/enzyme/#installation)
+See: [Installation](https://airbnb.io/enzyme/#installation)
 
 ### Jest snapshots
 
@@ -219,12 +224,12 @@ wrap.last()           // → ReactWrapper
 
 ```js
 wrap.get(0)           // → ReactElement
-wrap.getNode()        // → ReactElement
-wrap.getNodes()       // → Array<ReactElement>
+wrap.getElement()     // → ReactElement
+wrap.getElements()    // → Array<ReactElement>
 wrap.getDOMNode()     // → DOMComponent
 ```
 
-See: [Full rendering API](http://airbnb.io/enzyme/docs/api/mount.html)
+See: [Full rendering API](https://airbnb.io/enzyme/docs/api/mount.html)
 
 ### Actions
 
@@ -248,7 +253,7 @@ wrap.context()       // get full context
 
 ```js
 wrap.state('key')    // → any
-wrap.prop('key')    // → any
+wrap.prop('key')     // → any
 wrap.context('key')  // → any
 ```