2016-03-29 16:41:24 +08:00
|
|
|
import {React, ReactDOM} from 'nylas-exports';
|
2017-06-25 16:24:25 +08:00
|
|
|
const ReactTestUtils = require('react-dom/test-utils')
|
2016-03-22 09:25:43 +08:00
|
|
|
|
|
|
|
import MyComposerButton from '../lib/my-composer-button';
|
|
|
|
|
|
|
|
describe("MyComposerButton", () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
this.component = ReactTestUtils.renderIntoDocument(
|
2017-06-25 15:46:01 +08:00
|
|
|
<MyComposerButton headerMessageId="test" />
|
2016-03-22 09:25:43 +08:00
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should render into the page", () => {
|
|
|
|
expect(this.component).toBeDefined();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should have a displayName", () => {
|
|
|
|
expect(MyComposerButton.displayName).toBe('MyComposerButton');
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should show a dialog box when clicked", () => {
|
|
|
|
spyOn(this.component, '_onClick');
|
2016-03-29 16:41:24 +08:00
|
|
|
const buttonNode = ReactDOM.findDOMNode(this.component.refs.button);
|
2016-03-22 09:25:43 +08:00
|
|
|
ReactTestUtils.Simulate.click(buttonNode);
|
|
|
|
expect(this.component._onClick).toHaveBeenCalled();
|
|
|
|
});
|
|
|
|
});
|