summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--web-ui/app/js/mail_view/ui/mail_view.js2
-rw-r--r--web-ui/test/spec/mail_view/ui/mail_view.spec.js15
2 files changed, 16 insertions, 1 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 e4e2174a..4faba468 100644
--- a/web-ui/app/js/mail_view/ui/mail_view.js
+++ b/web-ui/app/js/mail_view/ui/mail_view.js
@@ -84,7 +84,7 @@ define(
this.attachTagCompletion(this.attr.mail);
this.select('tags').on('click', function (event) {
- this.removeTag($(event.target).data('tag'));
+ this.removeTag($(event.target).text());
}.bind(this));
this.addTagLoseFocus();
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 2d2d4688..86b40591 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
@@ -41,6 +41,21 @@ describeComponent('mail_view/ui/mail_view', function () {
expect(updateSpy.mostRecentCall.data.tags).toEqual(['other']);
});
+ it('removes the tag from email even if tag is highlighted', function () {
+ var updateSpy = spyOnEvent(document, Pixelated.events.mail.tags.update);
+
+ testData.mail.tags = ['tag', 'other'];
+ this.component.displayMail({}, testData);
+
+ var inboxTag = this.component.$node.find('.tag[data-tag="tag"]');
+ inboxTag.html('<em class="search-highlight">' + inboxTag.text() + '</em>');
+
+ this.component.$node.find('.search-highlight').click();
+
+ 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);