From a341be7677b2d036126176edede51daa8d5b9ced Mon Sep 17 00:00:00 2001 From: Steffen van Bergerem Date: Fri, 13 Jan 2017 14:58:56 +0100 Subject: [PATCH] Bump markdown-it-diaspora-mention --- Gemfile | 2 +- Gemfile.lock | 4 ++-- .../app/helpers/text_formatter_spec.js | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index f2d2289ec..dfdcb3e44 100644 --- a/Gemfile +++ b/Gemfile @@ -96,7 +96,7 @@ source "https://rails-assets.org" do gem "rails-assets-markdown-it", "8.0.0" gem "rails-assets-markdown-it-hashtag", "0.4.0" - gem "rails-assets-markdown-it-diaspora-mention", "1.0.0" + gem "rails-assets-markdown-it-diaspora-mention", "1.1.0" gem "rails-assets-markdown-it-sanitizer", "0.4.3" gem "rails-assets-markdown-it--markdown-it-for-inline", "0.1.1" gem "rails-assets-markdown-it-sub", "1.0.0" diff --git a/Gemfile.lock b/Gemfile.lock index 597609ce8..ac1519382 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -666,7 +666,7 @@ GEM rails-assets-jquery (>= 1.6) rails-assets-markdown-it--markdown-it-for-inline (0.1.1) rails-assets-markdown-it (8.0.0) - rails-assets-markdown-it-diaspora-mention (1.0.0) + rails-assets-markdown-it-diaspora-mention (1.1.0) rails-assets-markdown-it-hashtag (0.4.0) rails-assets-markdown-it-sanitizer (0.4.3) rails-assets-markdown-it-sub (1.0.0) @@ -1002,7 +1002,7 @@ DEPENDENCIES rails-assets-jquery-textchange (= 0.2.3)! rails-assets-markdown-it (= 8.0.0)! rails-assets-markdown-it--markdown-it-for-inline (= 0.1.1)! - rails-assets-markdown-it-diaspora-mention (= 1.0.0)! + rails-assets-markdown-it-diaspora-mention (= 1.1.0)! rails-assets-markdown-it-hashtag (= 0.4.0)! rails-assets-markdown-it-sanitizer (= 0.4.3)! rails-assets-markdown-it-sub (= 1.0.0)! diff --git a/spec/javascripts/app/helpers/text_formatter_spec.js b/spec/javascripts/app/helpers/text_formatter_spec.js index eca62cb4d..eb6f95686 100644 --- a/spec/javascripts/app/helpers/text_formatter_spec.js +++ b/spec/javascripts/app/helpers/text_formatter_spec.js @@ -86,6 +86,25 @@ describe("app.helpers.textFormatter", function(){ expect(wrapper.find("a[href='/people/" + this.alice.guid + "']")).not.toHaveClass('hovercardable'); expect(wrapper.find("a[href='/people/" + this.bob.guid + "']")).toHaveClass('hovercardable'); }); + + it("supports mentions without a given name", function() { + this.statusMessage.set({text: "hey there @{alice@example.com} and @{bob@example.com}"}); + var formattedText = this.formatter(this.statusMessage.get("text"), this.statusMessage.get("mentioned_people")); + var wrapper = $("
").html(formattedText); + + _.each([this.alice, this.bob], function(person) { + expect(wrapper.find("a[href='/people/" + person.guid + "']").text()).toContain(person.name); + }); + }); + + it("it uses the name given in the mention if it exists", function() { + this.statusMessage.set({text: "hey there @{Alice Awesome; alice@example.com} and @{bob@example.com}"}); + var formattedText = this.formatter(this.statusMessage.get("text"), this.statusMessage.get("mentioned_people")); + var wrapper = $("
").html(formattedText); + + expect(wrapper.find("a[href='/people/" + this.alice.guid + "']").text()).toContain("Alice Awesome"); + expect(wrapper.find("a[href='/people/" + this.bob.guid + "']").text()).toContain(this.bob.name); + }); }); context("highlight", function(){