Skip to content

Commit

Permalink
added test for this.openPortal()
Browse files Browse the repository at this point in the history
  • Loading branch information
tajo committed Jan 21, 2016
1 parent fe13fac commit 1ee7ed5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/portal_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ describe('react-portal', () => {
assert.equal(document.body.childElementCount, 1);
});

it('should open when this.openPortal() is called (used to programmatically open portal)', () => {
const wrapper = mount(<Portal><p>Hi</p></Portal>);
assert.equal(document.body.childElementCount, 0);
wrapper.instance().openPortal();
assert.equal(wrapper.instance().node.firstElementChild.tagName, 'P');
});

it('when props.isOpened is false and then set to true should open portal', () => {
const wrapper = mount(<Portal isOpened={false}><p>Hi</p></Portal>);
assert.equal(document.body.childElementCount, 0);
Expand Down

0 comments on commit 1ee7ed5

Please sign in to comment.