Skip to content

Commit

Permalink
test(react:can): covers multiple children rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
stalniy committed Aug 31, 2018
1 parent c022b32 commit 3db66ae
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/casl-react/spec/Can.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,16 @@ describe('`Can` component', () => {

expect(component.toJSON().children).to.deep.equal([child.props.children])
})

it('can render multiple children if `React.Fragment` is available', () => {
const children = [child, e('h1', null, 'another children')]
const component = renderer.create(
e(Can, { I: 'read', a: 'Post', ability }, ...children)
)
const renderedChildren = children.map(element => renderer.create(element).toJSON())

expect(component.toJSON()).to.deep.equal(renderedChildren)
})
})

function validateProps(Component, props, propName) {
Expand Down

0 comments on commit 3db66ae

Please sign in to comment.