diff options
author | Alexandre Pretto Nunes <anunes@thoughtworks.com> | 2015-04-09 19:32:25 -0300 |
---|---|---|
committer | rafael lisboa <rafaelzlisboa@gmail.com> | 2015-04-14 15:28:13 -0300 |
commit | 57770a2b6a0777656c86c7d464b5e413f904ac0e (patch) | |
tree | 468dba0c78e8451bdeaa8f47d375b0307f3a8140 /web-ui/test | |
parent | ce9e9aa5a21182a05985fc1e0fc9d543738b5fa0 (diff) |
Fix mail opening and add some tests
Diffstat (limited to 'web-ui/test')
-rw-r--r-- | web-ui/test/spec/mail_list/ui/mail_items/draft_item.spec.js | 32 | ||||
-rw-r--r-- | web-ui/test/test_data.js | 35 |
2 files changed, 66 insertions, 1 deletions
diff --git a/web-ui/test/spec/mail_list/ui/mail_items/draft_item.spec.js b/web-ui/test/spec/mail_list/ui/mail_items/draft_item.spec.js new file mode 100644 index 00000000..fbe285c6 --- /dev/null +++ b/web-ui/test/spec/mail_list/ui/mail_items/draft_item.spec.js @@ -0,0 +1,32 @@ +describeComponent('mail_list/ui/mail_items/draft_item', function () { + 'use strict'; + + var mail; + + beforeEach(function () { + mail = Pixelated.testData().parsedMail.draft; + + this.setupComponent('<li></li>', { + mail: mail, + selected: false, + templateType: 'single' + }); + }); + + it('should de-select the item if a new mail is composed', function () { + this.component.$node.addClass('selected'); + + $(document).trigger(Pixelated.events.ui.composeBox.newMessage); + + expect(this.component.$node).not.toHaveClass('selected'); + }); + + it('should trigger the openDraft event when clicked', function () { + var openDraftEvent = spyOnEvent(document, Pixelated.events.dispatchers.rightPane.openDraft); + + this.$node.find('a').click(); + + expect(openDraftEvent).toHaveBeenTriggeredOnAndWith(document, { ident: 'B2432' }); + }); +}); + diff --git a/web-ui/test/test_data.js b/web-ui/test/test_data.js index f09260c9..446fd7c6 100644 --- a/web-ui/test/test_data.js +++ b/web-ui/test/test_data.js @@ -170,6 +170,38 @@ define(function() { } }; + var draftMail = { + status: [], + header: {'from': 'jed_waelchi@cummerata.info', + cc: [], + bcc: [], + to: [], + date: '2015-04-09T18:30:18.998999-03:00', + subject: 'bla'}, + ident: 'B2432', + replying: {'single': 'jed_waelchi@cummerata.info', + all: { + 'to-field': ['jed_waelchi@cummerata.info'], + 'cc-field': [] + } + }, + attachments: [], + textPlainBody: 'bla', + tags: [], + htmlBody: null, + mailbox: 'drafts', + security_casing: {'locks': [], + imprints: [{'state': 'no_signature_information'}] + }, + isSentMail: function() { return false; }, + isDraftMail: function() { return false; }, + replyToAddress: function() { return { to: ['jed_waelchi@cummerata.info'], cc: [] }; }, + replyToAllAddress: function() { return { to: ['jed_waelchi@cummerata.info'], cc: [] }; }, + isMailMultipartAlternative: function () { return false; }, + availableBodyPartsContentType: function () { return []; }, + getMailPartByContentType: function () { return; } + }; + var testData = { rawMail: { mail: rawMail, @@ -182,7 +214,8 @@ define(function() { }, parsedMail: { simpleTextPlain: simpleTextPlainMail, - html: htmlNoEncodingMail + html: htmlNoEncodingMail, + draft: draftMail } }; |