2015-07-07 02:23:51 +08:00
|
|
|
{React} = require 'nylas-exports'
|
|
|
|
ReactTestUtils = React.addons.TestUtils
|
|
|
|
|
|
|
|
MyComposerButton = require '../lib/my-composer-button'
|
|
|
|
|
|
|
|
dialogStub =
|
|
|
|
showMessageBox: jasmine.createSpy('showMessageBox')
|
|
|
|
|
|
|
|
describe "MyComposerButton", ->
|
|
|
|
beforeEach ->
|
|
|
|
@component = ReactTestUtils.renderIntoDocument(
|
2015-08-29 02:12:53 +08:00
|
|
|
<MyComposerButton draftClientId="test" />
|
2015-07-07 02:23:51 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
it "should render into the page", ->
|
|
|
|
expect(@component).toBeDefined()
|
|
|
|
|
|
|
|
it "should have a displayName", ->
|
|
|
|
expect(MyComposerButton.displayName).toBe('MyComposerButton')
|
|
|
|
|
|
|
|
it "should show a dialog box when clicked", ->
|
|
|
|
spyOn(@component, '_onClick')
|
|
|
|
buttonNode = React.findDOMNode(@component.refs.button)
|
|
|
|
ReactTestUtils.Simulate.click(buttonNode)
|
2015-08-29 02:12:53 +08:00
|
|
|
expect(@component._onClick).toHaveBeenCalled()
|