mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-10 22:54:45 +08:00
fix(draft): fix popout draft error & add tests
Fixes T3506
This commit is contained in:
parent
0ba437b2ab
commit
d537797fa0
2 changed files with 24 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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 = {}
|
||||
|
|
Loading…
Add table
Reference in a new issue