describe("app.helpers.textFormatter", function(){ beforeEach(function(){ this.statusMessage = factory.post(); this.formatter = app.helpers.textFormatter; }); // Some basic specs. For more detailed specs see // https://github.com/svbergerem/markdown-it-hashtag/tree/master/test context("hashtags", function() { beforeEach(function() { this.tags = [ "tag", "diaspora", "PARTIES", "<3" ]; }); it("renders tags as links", function() { var formattedText = this.formatter('#'+this.tags.join(" #")); _.each(this.tags, function(tag) { var link ='#'+tag.replace("<","<")+''; expect(formattedText).toContain(link); }); }); }); // Some basic specs. For more detailed specs see // https://github.com/diaspora/markdown-it-diaspora-mention/tree/master/test context("mentions", function() { beforeEach(function(){ this.alice = factory.author({ name : "Alice Smith", diaspora_id : "alice@example.com", guid: "555", id : "555" }); this.bob = factory.author({ name : "Bob Grimm", diaspora_id : "bob@example.com", guid: "666", id : "666" }); this.statusMessage.set({text: "hey there @{Alice Smith; alice@example.com} and @{Bob Grimm; bob@example.com}"}); this.statusMessage.set({mentioned_people : [this.alice, this.bob]}); }); it("matches mentions", function(){ var formattedText = this.formatter(this.statusMessage.get("text"), this.statusMessage.get("mentioned_people")); var wrapper = $("