/* eslint-env mocha */
import React from 'react';
import ReactDOM from 'react-dom';
import {assert} from 'chai';
import {spy} from 'sinon';
import Portal from './Portal';
import {createMountWithContext} from 'test/utils';

describe('<Portal>', () => {
  let mount;

  before(() => mount = createMountWithContext());
  after(() => mount.cleanUp());

  it('should render nothing directly', () => {
    const wrapper = mount(<Portal><h1 className="woof">Hello</h1></Portal>);
    assert.strictEqual(wrapper.children().length, 0, 'should have no children');
  });

  it('should not open by default', () => {
    const wrapper = mount(<Portal><h1 className="woof">Hello</h1></Portal>);
    const instance = wrapper.instance();
    assert.strictEqual(wrapper.prop('open'), false, 'should be false by default');
    assert.strictEqual(instance.layer, undefined, 'should not have a layer');
  });

  describe('rendering and unrendering', () => {
    let wrapper;
    let instance;
    let portal;

    before(() => {
      wrapper = mount(<Portal open={true}><h1 id="woof">Hello</h1></Portal>);
      instance = wrapper.instance();
      portal = instance.layer;
    });

    it('should render the contents through a portal layer div', () => {
      assert.strictEqual(portal.tagName.toLowerCase(), 'div', 'should render a div element as the portal');
      assert.strictEqual(portal.firstChild.tagName.toLowerCase(), 'h1', 'should be a heading tag');
      assert.strictEqual(portal.firstChild.getAttribute('id'), 'woof', 'should have the woof id');
      assert.strictEqual(portal.firstChild.innerHTML, 'Hello', 'have the contents');
      portal.setAttribute('id', 'meow');
      assert.strictEqual(document.getElementById('meow'), portal, 'should have the portal in the DOM');
      assert.strictEqual(document.getElementById('woof'), portal.firstChild, 'should have the heading in the DOM');
    });

    it('should unrender the contents and remove the layer', () => {
      wrapper.setProps({open: false});
      assert.strictEqual(document.getElementById('meow'), null, 'should not have the portal in the DOM');
      assert.strictEqual(document.getElementById('woof'), null, 'should not have the heading in the DOM');
    });
  });
});

@@ -54,88 +54,27 @@
 ort 
-ReactDOM from 'react-dom';%0Aimport %7Bassert%7D from 'chai';%0Aimport %7Bspy%7D from 'sinon
+%7Bassert%7D from 'chai
 ';%0Ai

Fix lint errrors