summaryrefslogtreecommitdiff
path: root/web-ui
diff options
context:
space:
mode:
authorAlexandre Pretto Nunes <anunes@thoughtworks.com>2014-12-19 17:53:52 -0200
committerAlexandre Pretto Nunes <anunes@thoughtworks.com>2014-12-19 17:53:52 -0200
commit32fe00c7b23883a0ce35910537cb1966457624cb (patch)
treeca700d58f3a14c4ddb9fa2e2e63f87facb23bcf9 /web-ui
parent878ee42e6a4ee40c1f7e3ff537dd3bf21a76368f (diff)
#81 Fix checking if any mail is marked when on 'all' tag
Diffstat (limited to 'web-ui')
-rw-r--r--web-ui/app/js/mail_list/ui/mail_list.js2
-rw-r--r--web-ui/test/spec/mail_list/ui/mail_list.spec.js13
2 files changed, 13 insertions, 2 deletions
diff --git a/web-ui/app/js/mail_list/ui/mail_list.js b/web-ui/app/js/mail_list/ui/mail_list.js
index da79f20b..56c5c4f9 100644
--- a/web-ui/app/js/mail_list/ui/mail_list.js
+++ b/web-ui/app/js/mail_list/ui/mail_list.js
@@ -134,7 +134,7 @@ define(
this.checkedMailsForCurrentTag = function () {
var checkedMailsForCurrentTag = _.filter(self.attr.checkedMails, function (mail) {
- return mail.mailbox === self.attr.currentTag || _.contains(mail.tags, self.attr.currentTag);
+ return self.attr.currentTag === 'all' || mail.mailbox === self.attr.currentTag || _.contains(mail.tags, self.attr.currentTag);
});
return checkedMailsForCurrentTag.length > 0 ? checkedMailsForCurrentTag : {};
diff --git a/web-ui/test/spec/mail_list/ui/mail_list.spec.js b/web-ui/test/spec/mail_list/ui/mail_list.spec.js
index 5c285110..003830de 100644
--- a/web-ui/test/spec/mail_list/ui/mail_list.spec.js
+++ b/web-ui/test/spec/mail_list/ui/mail_list.spec.js
@@ -75,7 +75,18 @@ describeComponent('mail_list/ui/mail_list', function () {
it('returns the list of checked mails based on the current tag to whomever requests them', function () {
var caller = {};
this.component.attr.checkedMails = mailList;
- this.component.attr.currentTag = 'inbox';
+ this.component.attr.currentTag = 'inbox';
+ var mailHereCheckedEvent = spyOnEvent(caller, Pixelated.events.ui.mail.hereChecked);
+
+ $(document).trigger(Pixelated.events.ui.mail.wantChecked, caller);
+
+ expect(mailHereCheckedEvent).toHaveBeenTriggeredOnAndWith(caller, { checkedMails: mailList });
+ });
+
+ it('returns every checked mail when the curent tag is "all"', function () {
+ var caller = {};
+ this.component.attr.checkedMails = mailList;
+ this.component.attr.currentTag = 'all';
var mailHereCheckedEvent = spyOnEvent(caller, Pixelated.events.ui.mail.hereChecked);
$(document).trigger(Pixelated.events.ui.mail.wantChecked, caller);