mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-02 05:19:31 +08:00
fix(composer): fix popout composer and add spec
This commit is contained in:
parent
9b0ea76681
commit
91ccc940a6
3 changed files with 13 additions and 3 deletions
|
@ -575,9 +575,6 @@ class ComposerView extends React.Component
|
|||
|
||||
@_saveToHistory(selections) unless source.fromUndoManager
|
||||
|
||||
_popoutComposer: =>
|
||||
Actions.composePopoutDraft @props.draftClientId
|
||||
|
||||
_sendDraft: (options = {}) =>
|
||||
return unless @_proxy
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ _ = require 'underscore'
|
|||
React = require 'react'
|
||||
AccountContactField = require './account-contact-field'
|
||||
ParticipantsTextField = require './participants-text-field'
|
||||
{Actions} = require 'nylas-exports'
|
||||
{RetinaImg} = require 'nylas-component-kit'
|
||||
|
||||
Fields = require './fields'
|
||||
|
@ -160,6 +161,9 @@ class ExpandedParticipants extends React.Component
|
|||
hide: [Fields.Cc]
|
||||
focus: Fields.To
|
||||
|
||||
_popoutComposer: =>
|
||||
Actions.composePopoutDraft @props.draftClientId
|
||||
|
||||
_onEmptyBcc: =>
|
||||
if Fields.Cc in @props.enabledFields
|
||||
focus = Fields.Cc
|
||||
|
|
|
@ -4,6 +4,7 @@ Fields = require '../lib/fields'
|
|||
ReactTestUtils = React.addons.TestUtils
|
||||
AccountContactField = require '../lib/account-contact-field'
|
||||
ExpandedParticipants = require '../lib/expanded-participants'
|
||||
{Actions} = require 'nylas-exports'
|
||||
|
||||
describe "ExpandedParticipants", ->
|
||||
makeField = (props={}) ->
|
||||
|
@ -69,6 +70,14 @@ describe "ExpandedParticipants", ->
|
|||
els = ReactTestUtils.scryRenderedDOMComponentsWithClass(@fields, "show-popout")
|
||||
expect(els.length).toBe 0
|
||||
|
||||
it "pops out the composer when clicked", ->
|
||||
spyOn(Actions, "composePopoutDraft")
|
||||
makeField.call(@, mode: "inline")
|
||||
el = ReactTestUtils.findRenderedDOMComponentWithClass(@fields, "show-popout")
|
||||
ReactTestUtils.Simulate.click(React.findDOMNode(el))
|
||||
expect(Actions.composePopoutDraft).toHaveBeenCalled()
|
||||
expect(Actions.composePopoutDraft.calls.length).toBe 1
|
||||
|
||||
it "shows and focuses cc when clicked", ->
|
||||
makeField.call(@)
|
||||
el = ReactTestUtils.findRenderedDOMComponentWithClass(@fields, "show-cc")
|
||||
|
|
Loading…
Reference in a new issue