This commit is contained in:
Boyuzhou 2016-11-22 09:34:49 +08:00
parent 0994033401
commit 10c7f91093
2 changed files with 35 additions and 1 deletions

BIN
img/tinper-bee.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 KiB

View File

@ -5,7 +5,7 @@
- chai
- enzyme
### 用Enzyme测试
### 使用Enzyme测试
- shallow Rendering 测试虚拟dom
- DOM Rendering 测试真实dom
@ -73,3 +73,37 @@ describe('Enzyme Mount', function () {
- .state([key]):返回根组件的状态
- .setState(nextState):设置根组件的状态
- .setProps(nextProps):设置根组件的属性
### chai的expect语法
[官网](http://chaijs.com/api/bdd/)
#### 连接关键字
- to
- be
- been
- is
- that
- which
- and
- has
- have
- with
- at
- of
- same
这些关键字会在下面的例子中,有一些功能演示
#### 断言
- .not
```js
expect(foo).to.not.equal('bar');
expect(goodFn).to.not.throw(Error);
expect({ foo: 'baz' }).to.have.property('foo').and.not.equal('bar');
```
- .deep
```js
```