summaryrefslogtreecommitdiff
path: root/web-ui/test/spec
diff options
context:
space:
mode:
authorAlexandre Pretto Nunes <anunes@thoughtworks.com>2015-04-09 19:32:25 -0300
committerrafael lisboa <rafaelzlisboa@gmail.com>2015-04-14 15:28:13 -0300
commit57770a2b6a0777656c86c7d464b5e413f904ac0e (patch)
tree468dba0c78e8451bdeaa8f47d375b0307f3a8140 /web-ui/test/spec
parentce9e9aa5a21182a05985fc1e0fc9d543738b5fa0 (diff)
Fix mail opening and add some tests
Diffstat (limited to 'web-ui/test/spec')
-rw-r--r--web-ui/test/spec/mail_list/ui/mail_items/draft_item.spec.js32
1 files changed, 32 insertions, 0 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' });
+ });
+});
+