Skip to content

Commit

Permalink
fix(test): normalize html and format the test file
Browse files Browse the repository at this point in the history
  • Loading branch information
yuche committed Mar 15, 2018
1 parent a15935d commit a0de170
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions packages/nerv/__tests__/component.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,23 +174,16 @@ describe('Component', function () {
}
render () {
const xxx = this.state.xxx
return (
<Child>
{xxx ? <div>{xxx}</div> : ''}
</Child>
)
return <Child>{xxx ? <div>{xxx}</div> : ''}</Child>
}
}

expect(() => {
render(
<Daddy />,
scratch
)
render(<Daddy />, scratch)
inst.setState({ xxx: false })
inst.forceUpdate()
}).not.toThrow()
expect(scratch.innerHTML).toEqual('<div></div>')
expect(scratch.innerHTML).toEqual(normalizeHTML('<div></div>'))
})

it('should remove children when root changes to text node', () => {
Expand Down Expand Up @@ -474,10 +467,7 @@ describe('Component', function () {
it('(StatelessComponent) should support function returning null', () => {
const FunctionReturningNull = () => null
expect(() => {
render(
<FunctionReturningNull />,
scratch
)
render(<FunctionReturningNull />, scratch)
}).not.toThrow()
})
})
Expand Down

0 comments on commit a0de170

Please sign in to comment.