mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-10-04 10:28:46 +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
|
@_saveToHistory(selections) unless source.fromUndoManager
|
||||||
|
|
||||||
_popoutComposer: =>
|
|
||||||
Actions.composePopoutDraft @props.draftClientId
|
|
||||||
|
|
||||||
_sendDraft: (options = {}) =>
|
_sendDraft: (options = {}) =>
|
||||||
return unless @_proxy
|
return unless @_proxy
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ _ = require 'underscore'
|
||||||
React = require 'react'
|
React = require 'react'
|
||||||
AccountContactField = require './account-contact-field'
|
AccountContactField = require './account-contact-field'
|
||||||
ParticipantsTextField = require './participants-text-field'
|
ParticipantsTextField = require './participants-text-field'
|
||||||
|
{Actions} = require 'nylas-exports'
|
||||||
{RetinaImg} = require 'nylas-component-kit'
|
{RetinaImg} = require 'nylas-component-kit'
|
||||||
|
|
||||||
Fields = require './fields'
|
Fields = require './fields'
|
||||||
|
@ -160,6 +161,9 @@ class ExpandedParticipants extends React.Component
|
||||||
hide: [Fields.Cc]
|
hide: [Fields.Cc]
|
||||||
focus: Fields.To
|
focus: Fields.To
|
||||||
|
|
||||||
|
_popoutComposer: =>
|
||||||
|
Actions.composePopoutDraft @props.draftClientId
|
||||||
|
|
||||||
_onEmptyBcc: =>
|
_onEmptyBcc: =>
|
||||||
if Fields.Cc in @props.enabledFields
|
if Fields.Cc in @props.enabledFields
|
||||||
focus = Fields.Cc
|
focus = Fields.Cc
|
||||||
|
|
|
@ -4,6 +4,7 @@ Fields = require '../lib/fields'
|
||||||
ReactTestUtils = React.addons.TestUtils
|
ReactTestUtils = React.addons.TestUtils
|
||||||
AccountContactField = require '../lib/account-contact-field'
|
AccountContactField = require '../lib/account-contact-field'
|
||||||
ExpandedParticipants = require '../lib/expanded-participants'
|
ExpandedParticipants = require '../lib/expanded-participants'
|
||||||
|
{Actions} = require 'nylas-exports'
|
||||||
|
|
||||||
describe "ExpandedParticipants", ->
|
describe "ExpandedParticipants", ->
|
||||||
makeField = (props={}) ->
|
makeField = (props={}) ->
|
||||||
|
@ -69,6 +70,14 @@ describe "ExpandedParticipants", ->
|
||||||
els = ReactTestUtils.scryRenderedDOMComponentsWithClass(@fields, "show-popout")
|
els = ReactTestUtils.scryRenderedDOMComponentsWithClass(@fields, "show-popout")
|
||||||
expect(els.length).toBe 0
|
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", ->
|
it "shows and focuses cc when clicked", ->
|
||||||
makeField.call(@)
|
makeField.call(@)
|
||||||
el = ReactTestUtils.findRenderedDOMComponentWithClass(@fields, "show-cc")
|
el = ReactTestUtils.findRenderedDOMComponentWithClass(@fields, "show-cc")
|
||||||
|
|
Loading…
Add table
Reference in a new issue