import React from 'react';
import TestUtils from 'react-dom/test-utils';
import expect from 'expect.js';

import Notification from '../';

require('../assets/index.less');

describe('rc-notification', () => {
  it('works', (done) => {
    const notification = Notification.newInstance();
    notification.notice({
      content: <p className="test">1</p>,
      duration: 0.1,
    });
    expect(TestUtils.scryRenderedDOMComponentsWithClass(notification.component,
      'test').length).to.be(1);
    setTimeout(() => {
      expect(TestUtils.scryRenderedDOMComponentsWithClass(notification.component,
        'test').length).to.be(0);
      notification.destroy();
      done();
    }, 1000);
  });

  it('destroy works', () => {
    const notification = Notification.newInstance();
    notification.notice({
      content: <p id="test" className="test">222222</p>,
      duration: 0.1,
    });
    expect(TestUtils.scryRenderedDOMComponentsWithClass(notification.component,
      'test').length).to.be(1);
    notification.destroy();
    expect(document.getElementById('test')).not.to.be.ok();
  });

  it('getContainer works', () => {
    const notification = Notification.newInstance({
      getContainer: () => {
        const div = document.createElement('div');
        div.className = 'rc';
        document.body.appendChild(div);
        return div;
      },
    });
    notification.notice({
      content: <p id="test" className="test">222222</p>,
      duration: 1,
    });
    expect(document.querySelectorAll('.rc').length).to.be(1);
  });
});

@@ -690,24 +690,800 @@
 00);%0A  %7D);%0A%0A
+  it('works with multi instance', (done) =%3E %7B%0A    const notification = Notification.newInstance();%0A    notification.notice(%7B%0A      content: %3Cp className=%22test%22%3E1%3C/p%3E,%0A      duration: 0.1,%0A    %7D);%0A    notification.notice(%7B%0A      content: %3Cp className=%22test%22%3E2%3C/p%3E,%0A      duration: 0.5,%0A    %7D);%0A    expect(TestUtils.scryRenderedDOMComponentsWithClass(notification.component,%0A      'test').length).to.be(2);%0A    setTimeout(() =%3E %7B%0A      expect(TestUtils.scryRenderedDOMComponentsWithClass(notification.component,%0A        'test').length).to.be(1);%0A      done();%0A    %7D, 1000);%0A    setTimeout(() =%3E %7B%0A      expect(TestUtils.scryRenderedDOMComponentsWithClass(notification.component,%0A        'test').length).to.be(0);%0A      notification.destroy();%0A      done();%0A    %7D, 5000);%0A  %7D);%0A%0A
   it('destro

add test for mutli instance