From 57770a2b6a0777656c86c7d464b5e413f904ac0e Mon Sep 17 00:00:00 2001 From: Alexandre Pretto Nunes Date: Thu, 9 Apr 2015 19:32:25 -0300 Subject: Fix mail opening and add some tests --- .../mail_list/ui/mail_items/draft_item.spec.js | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 web-ui/test/spec/mail_list/ui/mail_items/draft_item.spec.js (limited to 'web-ui/test/spec') 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('
  • ', { + 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' }); + }); +}); + -- cgit v1.2.3