summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuda Dornelles <ddornell@thoughtworks.com>2015-02-12 14:04:04 -0200
committerDuda Dornelles <ddornell@thoughtworks.com>2015-02-12 14:08:27 -0200
commit4e43fa4e81aeb9a66c150d1dbf1c21b13dbce66e (patch)
treefde434601751d97d16cc8481d7d09bf9f439f207
parentc89983e82f69e915e6a62dab0b4610c789a9914c (diff)
#220 fixing issue were we couldnt delete a tag that was highlighted
-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);