mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-14 05:41:05 +08:00
6315bc9d80
Summary: - Rewrites composer extension adpater to support all versions of the ComposerExtension API we've ever declared. This will allow old plugins (or plugins that haven't been reinstalled after update) to keep functioning without breaking N1 - Adds specs Test Plan: - Unit tests Reviewers: evan, bengotow Reviewed By: bengotow Differential Revision: https://phab.nylas.com/D2399
28 lines
1.1 KiB
CoffeeScript
28 lines
1.1 KiB
CoffeeScript
Autolinker = require 'autolinker'
|
|
AutolinkerExtension = require '../lib/plugins/autolinker-extension'
|
|
|
|
describe "AutolinkerExtension", ->
|
|
beforeEach ->
|
|
spyOn(Autolinker, 'link').andCallFake (txt) => txt
|
|
|
|
it "should call through to Autolinker", ->
|
|
AutolinkerExtension.formatMessageBody(message: {body:'body'})
|
|
expect(Autolinker.link).toHaveBeenCalledWith('body', {twitter: false})
|
|
|
|
it "should add a title to everything with an href", ->
|
|
message =
|
|
body: """
|
|
<a href="apple.com">hello world!</a>
|
|
<a href = "http://apple.com">hello world!</a>
|
|
<a href ='http://apple.com'>hello world!</a>
|
|
<a href ='mailto://'>hello world!</a>
|
|
"""
|
|
expected =
|
|
body: """
|
|
<a href="apple.com" title="apple.com" >hello world!</a>
|
|
<a href = "http://apple.com" title="http://apple.com" >hello world!</a>
|
|
<a href ='http://apple.com' title='http://apple.com' >hello world!</a>
|
|
<a href ='mailto://' title='mailto://' >hello world!</a>
|
|
"""
|
|
AutolinkerExtension.formatMessageBody({message})
|
|
expect(message.body).toEqual(expected.body)
|