Commit 880a233e authored by Robert Speicher's avatar Robert Speicher

Add specs for parsing Emoji

parent d480a478
...@@ -208,6 +208,40 @@ describe GitlabMarkdownHelper do ...@@ -208,6 +208,40 @@ describe GitlabMarkdownHelper do
gfm(actual).should match(expected) gfm(actual).should match(expected)
end end
end end
describe "emoji" do
it "matches at the start of a string" do
gfm(":+1:").should match(/<img/)
end
it "matches at the end of a string" do
gfm("This gets a :-1:").should match(/<img/)
end
it "matches with adjacent text" do
gfm("+1 (:+1:)").should match(/<img/)
end
it "has a title attribute" do
gfm(":-1:").should match(/title=":-1:"/)
end
it "has an alt attribute" do
gfm(":-1:").should match(/alt=":-1:"/)
end
it "has an emoji class" do
gfm(":+1:").should match('class="emoji"')
end
it "keeps whitespace intact" do
gfm("This deserves a :+1: big time.").should match(/deserves a <img.+\/> big time/)
end
it "ignores invalid emoji" do
gfm(":invalid-emoji:").should_not match(/<img/)
end
end
end end
describe "#link_to_gfm" do describe "#link_to_gfm" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment