diff --git a/package.json b/package.json index 1c99a3057..ad8a0ecb0 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "6to5-core": "^3.5", "async": "^0.9", "atom-keymap": "^5.1", + "aws-sdk": "2.1.28", "bluebird": "^2.9", "clear-cut": "0.4.0", "coffee-react": "^2.0.0", @@ -37,6 +38,7 @@ "jasmine-json": "~0.0", "jasmine-tagged": "^1.1.2", "jquery": "^2.1.1", + "juice": "^1.4", "less-cache": "0.21", "marked": "^0.3", "mkdirp": "^0.5", @@ -57,7 +59,7 @@ "request": "^2.53", "request-progress": "^0.3", "runas": "^2.0", - "sanitize-html": "^1.5", + "sanitize-html": "^1.9", "scandal": "2.0.0", "scoped-property-store": "^0.16.2", "scrollbar-style": "^2.0", @@ -66,15 +68,14 @@ "serializable": "^1", "service-hub": "^0.2.0", "space-pen": "3.8.2", + "spellchecker": "2.2.1", "stacktrace-parser": "^0.1", "temp": "^0.8", "text-buffer": "^4.1", "theorist": "^1.0", "underscore": "^1.8", "underscore.string": "^3.0", - "vm-compatibility-layer": "0.1.0", - "spellchecker": "2.2.1", - "aws-sdk": "2.1.28" + "vm-compatibility-layer": "0.1.0" }, "devDependencies": { "proxyquire": "git+https://github.com/bengotow/proxyquire", diff --git a/spec-nylas/stores/draft-store-spec.coffee b/spec-nylas/stores/draft-store-spec.coffee index fd0b2d110..0108432ac 100644 --- a/spec-nylas/stores/draft-store-spec.coffee +++ b/spec-nylas/stores/draft-store-spec.coffee @@ -10,6 +10,7 @@ SendDraftTask = require '../../src/flux/tasks/send-draft' DestroyDraftTask = require '../../src/flux/tasks/destroy-draft' Actions = require '../../src/flux/actions' Utils = require '../../src/flux/models/utils' +ipc = require 'ipc' _ = require 'underscore' fakeThread = null @@ -18,6 +19,7 @@ fakeMessage2 = null msgFromMe = null msgWithReplyTo = null msgWithReplyToDuplicates = null +messageWithStyleTags = null fakeMessages = null class TestExtension extends DraftStoreExtension @@ -30,6 +32,18 @@ describe "DraftStore", -> describe "creating drafts", -> beforeEach -> + spyOn(DraftStore, "_sanitizeBody").andCallThrough() + spyOn(DraftStore, "_onInlineStylesResult").andCallThrough() + spyOn(DraftStore, "_convertToInlineStyles").andCallThrough() + spyOn(ipc, "send").andCallFake (message, body) -> + if message is "inline-style-parse" + # There needs to be a defer block in here so the promise + # responsible for handling the `inline-style-parse` can be + # properly set. If the whole path is synchronous instead of + # asynchrounous, the promise is not cleared properly. Doing this + # requires us to add `advanceClock` blocks. + _.defer -> DraftStore._onInlineStylesResult(body) + fakeThread = new Thread id: 'fake-thread-id' subject: 'Fake Subject' @@ -88,12 +102,24 @@ describe "DraftStore", -> subject: 'Re: Fake Subject' date: new Date(1415814587) + messageWithStyleTags = new Message + id: 'message-with-style-tags' + to: [new Contact(email: 'ben@nylas.com'), new Contact(email: 'evan@nylas.com')] + cc: [new Contact(email: 'mg@nylas.com'), new Contact(email: AccountStore.current().me().email)] + bcc: [new Contact(email: 'recruiting@nylas.com')] + from: [new Contact(email: 'customer@example.com', name: 'Customer')] + threadId: 'fake-thread-id' + body: '