mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-12 15:44:40 +08:00
More spec fixes
This commit is contained in:
parent
162872fc82
commit
651ea8c1c5
4 changed files with 23 additions and 9 deletions
|
@ -1,6 +1,8 @@
|
|||
React = require 'react/addons'
|
||||
classNames = require 'classnames'
|
||||
{Actions, WorkspaceStore, FocusedMailViewStore} = require 'nylas-exports'
|
||||
{Actions,
|
||||
WorkspaceStore,
|
||||
FocusedPerspectiveStore} = require 'nylas-exports'
|
||||
{Menu, RetinaImg, KeyCommandsRegion} = require 'nylas-component-kit'
|
||||
SearchSuggestionStore = require './search-suggestion-store'
|
||||
_ = require 'underscore'
|
||||
|
|
|
@ -3,6 +3,8 @@ fs = require 'fs'
|
|||
NylasAPI = require '../../src/flux/nylas-api'
|
||||
File = require '../../src/flux/models/file'
|
||||
FileDownloadStore = require '../../src/flux/stores/file-download-store'
|
||||
AccountStore = require '../../src/flux/stores/account-store'
|
||||
|
||||
Download = FileDownloadStore.Download
|
||||
|
||||
describe "FileDownloadStore.Download", ->
|
||||
|
@ -26,7 +28,8 @@ describe "FileDownloadStore.Download", ->
|
|||
|
||||
describe "run", ->
|
||||
beforeEach ->
|
||||
@download = new Download(fileId: '123', targetPath: 'test.png', filename: 'test.png')
|
||||
account = AccountStore.accounts()[0]
|
||||
@download = new Download(fileId: '123', targetPath: 'test.png', filename: 'test.png', accountId: account.id)
|
||||
@download.run()
|
||||
expect(NylasAPI.makeRequest).toHaveBeenCalled()
|
||||
|
||||
|
@ -39,10 +42,19 @@ describe "FileDownloadStore.Download", ->
|
|||
|
||||
describe "FileDownloadStore", ->
|
||||
beforeEach ->
|
||||
account = AccountStore.accounts()[0]
|
||||
|
||||
spyOn(shell, 'showItemInFolder')
|
||||
spyOn(shell, 'openItem')
|
||||
@testfile = new File(filename: '123.png', contentType: 'image/png', id: "id", size: 100)
|
||||
@testfile = new File({
|
||||
accountId: account.id,
|
||||
filename: '123.png',
|
||||
contentType: 'image/png',
|
||||
id: "id",
|
||||
size: 100
|
||||
})
|
||||
@testdownload = new Download({
|
||||
accountId: account.id,
|
||||
state : 'unknown',
|
||||
fileId : 'id',
|
||||
percent : 0,
|
||||
|
|
|
@ -19,7 +19,7 @@ if not NylasEnv.isMainWindow() and not NylasEnv.inSpecMode() then return
|
|||
|
||||
DraftCountStore = Reflux.createStore
|
||||
init: ->
|
||||
@listenTo FocusedPerspectiveStore, @_onFocusedMailViewChanged
|
||||
@listenTo FocusedPerspectiveStore, @_onFocusedPerspectiveChanged
|
||||
@listenTo DraftStore, @_onDraftChanged
|
||||
@_view = FocusedPerspectiveStore.current()
|
||||
@_count = null
|
||||
|
@ -29,7 +29,7 @@ DraftCountStore = Reflux.createStore
|
|||
count: ->
|
||||
@_count
|
||||
|
||||
_onFocusedMailViewChanged: ->
|
||||
_onFocusedPerspectiveChanged: ->
|
||||
view = FocusedPerspectiveStore.current()
|
||||
if view? and not(view.isEqual(@_view))
|
||||
@_view = view
|
||||
|
|
|
@ -369,9 +369,9 @@ class DraftStore
|
|||
SanitizeTransformer.run(body, SanitizeTransformer.Preset.UnsafeOnly)
|
||||
|
||||
_onPopoutBlankDraft: =>
|
||||
account = FocusedPerspectiveStore.current()?.account
|
||||
# TODO Remove this when we add account selector inside composer
|
||||
return unless account
|
||||
account = FocusedPerspectiveStore.current()?.account
|
||||
account ?= AccountStore.accounts()[0]
|
||||
|
||||
draft = new Message
|
||||
body: ""
|
||||
|
@ -407,9 +407,9 @@ class DraftStore
|
|||
windowProps: _.extend(options, {draftClientId})
|
||||
|
||||
_onHandleMailtoLink: (event, urlString) =>
|
||||
account = FocusedPerspectiveStore.current()?.account
|
||||
# TODO Remove this when we add account selector inside composer
|
||||
return unless account
|
||||
account = FocusedPerspectiveStore.current()?.account
|
||||
account ?= AccountStore.accounts()[0]
|
||||
|
||||
try
|
||||
urlString = decodeURI(urlString)
|
||||
|
|
Loading…
Add table
Reference in a new issue