From b06b794de750d972a9dff9165e203815b79c5b62 Mon Sep 17 00:00:00 2001 From: Alexandre Pretto Date: Thu, 8 Jan 2015 18:48:48 -0200 Subject: #157: mail api to return htmlBody and textPlainBody so the UI doesnt have to parse the multipart mails anymore --- web-ui/test/spec/helpers/view_helper.spec.js | 14 ++------ web-ui/test/spec/services/model/mail.spec.js | 51 ---------------------------- 2 files changed, 2 insertions(+), 63 deletions(-) (limited to 'web-ui/test/spec') diff --git a/web-ui/test/spec/helpers/view_helper.spec.js b/web-ui/test/spec/helpers/view_helper.spec.js index 217ac890..3399baa8 100644 --- a/web-ui/test/spec/helpers/view_helper.spec.js +++ b/web-ui/test/spec/helpers/view_helper.spec.js @@ -11,7 +11,7 @@ define(['helpers/view_helper'], function (viewHelper) { describe('quote email', function() { it('should add > to body text', function() { - testData.rawMail.mail.body = 'First Line\nSecond Line'; + testData.rawMail.mail.textPlainBody = 'First Line\nSecond Line'; var quotedMail = viewHelper.quoteMail(testData.rawMail.mail); @@ -55,20 +55,10 @@ define(['helpers/view_helper'], function (viewHelper) { }); }); - it('formats the body of a multipart email', function () { - expect(viewHelper.formatMailBody(testData.parsedMail.html)).toContainHtml('

Hello everyone!

'); - }); - it('formats the body of a plain text email', function () { var formatedMail = $('
'); formatedMail.html(viewHelper.formatMailBody(testData.parsedMail.simpleTextPlain)); - expect(formatedMail).toContainHtml('

Hello Everyone

'); - }); - - it('decodes a quoted-printable email body', function () { - var result = viewHelper.formatMailBody(testData.parsedMail.htmlQuotedPrintable); - - expect(result).toContainHtml('

Hello everyone!

'); + expect(formatedMail).toContainHtml('

HNello Everyone

'); }); it('move caret to the end of text after 1ms', function () { diff --git a/web-ui/test/spec/services/model/mail.spec.js b/web-ui/test/spec/services/model/mail.spec.js index 35c4bc9b..f9d076f0 100644 --- a/web-ui/test/spec/services/model/mail.spec.js +++ b/web-ui/test/spec/services/model/mail.spec.js @@ -34,57 +34,6 @@ require(['services/model/mail'], function (Mail) { }); }); - describe('multipart email', function () { - var parsedMultipartMail; - - beforeEach(function () { - parsedMultipartMail = Mail.create(Pixelated.testData().rawMail.multipart); - }); - - it('parses the mail as multipart/alternative', function () { - expect(parsedMultipartMail.isMailMultipartAlternative()).toBe(true); - }); - - it('lists the correct available content-type of the parts', function () { - expect(parsedMultipartMail.availableBodyPartsContentType()).toEqual(['text/plain;', 'text/html;']); - }); - - it('gets the list of parts', function () { - var expectedParts = [ - { - headers: { 'Content-Type': 'text/plain;' }, - body: 'Hello everyone!\n' - }, - { - headers: { - 'Content-Type': 'text/html;', - 'Content-Transfer-Encoding': 'quoted-printable' - }, - body: '

Hello everyone!

\n' - } - ]; - - expect(parsedMultipartMail.getMailMultiParts()).toEqual(expectedParts); - }); - - it('gets the text/plain body by the content-type', function () { - expect(parsedMultipartMail.getMailPartByContentType('text/plain;')).toEqual( - { - headers: { 'Content-Type': 'text/plain;' }, - body: 'Hello everyone!\n' - }); - }); - - it('parses the content type of a text/html body', function () { - expect(parsedMultipartMail.getMailPartByContentType('text/html;')).toEqual({ - headers: { - 'Content-Type': 'text/html;', - 'Content-Transfer-Encoding': 'quoted-printable' - }, - body: '

Hello everyone!

\n' - }); - }); - }); }); }); }); -- cgit v1.2.3