mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-01-25 09:30:13 +08:00
9f309d399b
Summary: - Rename DraftStoreExtension to ComposerExtension - Rename MessageStoreExtension to MessageViewExtension - Rename ContenteditablePlugin to ContenteditableExtension - Update Contenteditable to use new naming convention - Adds support for extension handlers as props - Add ExtensionRegistry to register extensions: - ContenteditableExtensions will not be registered through the ExtensionRegistry. They are meant for internal use, or if anyone wants to use our Contenteditable component directly in their plugins. - Adds specs - Refactors internal_packages and src to use new names and new ExtensionRegistry api - Adds deprecation util function and deprecation notices for old api methods: - DraftStore.{registerExtension, unregisterExtension} - MessageStore.{registerExtension, unregisterExtension} - DraftStoreExtension.{onMouseUp, onTabDown} - MessageStoreExtension - Adds and updates docs Test Plan: - Unit tests Reviewers: bengotow, evan Reviewed By: evan Differential Revision: https://phab.nylas.com/D2293
36 lines
1.5 KiB
CoffeeScript
36 lines
1.5 KiB
CoffeeScript
{Message} = require 'nylas-exports'
|
|
|
|
SignatureComposerExtension = require '../lib/signature-composer-extension'
|
|
|
|
describe "SignatureComposerExtension", ->
|
|
describe "prepareNewDraft", ->
|
|
describe "when a signature is defined", ->
|
|
beforeEach ->
|
|
@signature = "<div id='signature'>This is my signature.</div>"
|
|
spyOn(NylasEnv.config, 'get').andCallFake =>
|
|
@signature
|
|
|
|
it "should insert the signature at the end of the message or before the first blockquote and have a newline", ->
|
|
a = new Message
|
|
draft: true
|
|
body: 'This is a test! <blockquote>Hello world</blockquote>'
|
|
b = new Message
|
|
draft: true
|
|
body: 'This is a another test.'
|
|
|
|
SignatureComposerExtension.prepareNewDraft(a)
|
|
expect(a.body).toEqual("This is a test!<br/><div id='signature'>This is my signature.</div><blockquote>Hello world</blockquote>")
|
|
SignatureComposerExtension.prepareNewDraft(b)
|
|
expect(b.body).toEqual("This is a another test<br/><div id='signature'>This is my signature.</div>")
|
|
|
|
describe "when a signature is not defined", ->
|
|
beforeEach ->
|
|
spyOn(NylasEnv.config, 'get').andCallFake ->
|
|
null
|
|
|
|
it "should not do anything", ->
|
|
a = new Message
|
|
draft: true
|
|
body: 'This is a test! <blockquote>Hello world</blockquote>'
|
|
SignatureComposerExtension.prepareNewDraft(a)
|
|
expect(a.body).toEqual('This is a test! <blockquote>Hello world</blockquote>')
|