summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--web-ui/app/js/mail_view/ui/mail_view.js1
-rw-r--r--web-ui/test/spec/mail_view/ui/mail_view.spec.js13
2 files changed, 14 insertions, 0 deletions
diff --git a/web-ui/app/js/mail_view/ui/mail_view.js b/web-ui/app/js/mail_view/ui/mail_view.js
index 136b701c..e4e2174a 100644
--- a/web-ui/app/js/mail_view/ui/mail_view.js
+++ b/web-ui/app/js/mail_view/ui/mail_view.js
@@ -179,6 +179,7 @@ define(
};
this.removeTag = function (tag) {
+ tag = tag.toString();
var filteredTags = _.without(this.attr.mail.tags, tag);
this.updateTags(this.attr.mail, filteredTags);
this.trigger(document, events.dispatchers.tags.refreshTagList);
diff --git a/web-ui/test/spec/mail_view/ui/mail_view.spec.js b/web-ui/test/spec/mail_view/ui/mail_view.spec.js
index 55b37de2..2d2d4688 100644
--- a/web-ui/test/spec/mail_view/ui/mail_view.spec.js
+++ b/web-ui/test/spec/mail_view/ui/mail_view.spec.js
@@ -33,10 +33,23 @@ describeComponent('mail_view/ui/mail_view', function () {
it('removes the tag from the mail when the tag label is clicked', function() {
var updateSpy = spyOnEvent(document, Pixelated.events.mail.tags.update);
+ testData.mail.tags = ['inbox', 'other'];
this.component.displayMail({}, testData);
this.component.removeTag('inbox');
expect(updateSpy).toHaveBeenTriggeredOn(document);
+ expect(updateSpy.mostRecentCall.data.tags).toEqual(['other']);
+ });
+
+ it('removes numeric tag from the mail when its label is clicked', function() {
+ var updateSpy = spyOnEvent(document, Pixelated.events.mail.tags.update);
+
+ testData.mail.tags = ['inbox', '12345'];
+ this.component.displayMail({}, testData);
+ this.component.removeTag(12345);
+
+ expect(updateSpy).toHaveBeenTriggeredOn(document);
+ expect(updateSpy.mostRecentCall.data.tags).toEqual(['inbox']);
});
it('remove tag triggers refreshTagList event', function(){