Mailspring/static/package-template/spec/my-composer-button-spec.jsx

28 lines
804 B
React
Raw Normal View History

import {React} from 'nylas-exports';
const ReactTestUtils = React.addons.TestUtils
import MyComposerButton from '../lib/my-composer-button';
describe("MyComposerButton", () => {
beforeEach(() => {
this.component = ReactTestUtils.renderIntoDocument(
<MyComposerButton draftClientId="test" />
);
});
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');
const buttonNode = React.findDOMNode(this.component.refs.button);
ReactTestUtils.Simulate.click(buttonNode);
expect(this.component._onClick).toHaveBeenCalled();
});
});