fix(draft): fix popout draft error & add tests

Fixes T3506
This commit is contained in:
Evan Morikawa 2015-09-06 14:55:06 -07:00
parent 0ba437b2ab
commit d537797fa0
2 changed files with 24 additions and 2 deletions

View file

@ -363,6 +363,28 @@ describe "DraftStore", ->
expect(DraftStore._convertToInlineStyles).toHaveBeenCalled()
expect(DraftStore._onInlineStylesResult).toHaveBeenCalled()
describe "popout drafts", ->
beforeEach ->
spyOn(Actions, "composePopoutDraft")
it "can popout a reply", ->
runs ->
DraftStore._onComposeReply({threadId: fakeThread.id, messageId: fakeMessage1.id, popout: true}).catch (error) -> throw new Error (error)
waitsFor ->
DatabaseStore.persistModel.callCount > 0
runs ->
@model = DatabaseStore.persistModel.mostRecentCall.args[0]
expect(Actions.composePopoutDraft).toHaveBeenCalledWith(@model.clientId)
it "can popout a forward", ->
runs ->
DraftStore._onComposeForward({threadId: fakeThread.id, messageId: fakeMessage1.id, popout: true}).catch (error) -> throw new Error (error)
waitsFor ->
DatabaseStore.persistModel.callCount > 0
runs ->
@model = DatabaseStore.persistModel.mostRecentCall.args[0]
expect(Actions.composePopoutDraft).toHaveBeenCalledWith(@model.clientId)
describe "_newMessageWithContext", ->
beforeEach ->
# A helper method that makes it easy to test _newMessageWithContext, which

View file

@ -238,8 +238,8 @@ class DraftStore
.then @_prepareNewMessageAttributes
.then @_constructDraft
.then @_finalizeAndPersistNewMessage
.then ({draftLocalId}) =>
Actions.composePopoutDraft(draftLocalId) if args.popout
.then ({draftClientId}) =>
Actions.composePopoutDraft(draftClientId) if args.popout
_buildModelResolvers: ({thread, threadId, message, messageId}) ->
queries = {}