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.goodTags = [ "tag", "diaspora", "PARTIES", "<3", "diaspora-dev", "diaspora_dev", // issue #5765 "മലയാണ്മ", // issue #5815 "ինչո՞ւ", "այո՜ո", "սեւ֊սպիտակ", "գժանո՛ց" ]; this.badTags = [ "tag.tag", "hash:tag", "hash*tag" ]; }); it("renders good tags as links", function() { var self = this; this.goodTags.forEach(function(tag) { var formattedText = self.formatter("#newhashtag #" + tag + " test"); var link = "#" + tag.replace("<", "<") + ""; expect(formattedText).toContain(link); }); }); it("doesn't render bad tags as links", function() { var self = this; this.badTags.forEach(function(tag) { var formattedText = self.formatter("#newhashtag #" + tag + " test"); var link = "#" + tag.replace("<", "<") + ""; expect(formattedText).not.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 = $("
oh, cool, nginx 1.7.9 supports json autoindexes: http://nginx.org/en/docs/http/ngx_http_autoindex_module.html#autoindex_format
' ]; for (var i = 0; i < contents.length; i++) { expect(this.formatter(contents[i])).toContain(results[i]); } }); }); });