summaryrefslogtreecommitdiff
path: root/spec/helpers
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2012-09-05 16:05:20 -0400
committerRobert Speicher <rspeicher@gmail.com>2012-09-05 16:05:20 -0400
commit880a233e6d1bcf0dbeb9d1a01fb816b77ed21cc9 (patch)
treeeb273bb70fc6b84638a70a428ce0fea425ead46e /spec/helpers
parentd480a478c1cb1246e1dad80cc438c5556a3eb33f (diff)
downloadgitlab-ce-880a233e6d1bcf0dbeb9d1a01fb816b77ed21cc9.tar.gz
Add specs for parsing Emoji
Diffstat (limited to 'spec/helpers')
-rw-r--r--spec/helpers/gitlab_markdown_helper_spec.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/helpers/gitlab_markdown_helper_spec.rb b/spec/helpers/gitlab_markdown_helper_spec.rb
index 00164e0cdd7..e2b38f0a715 100644
--- a/spec/helpers/gitlab_markdown_helper_spec.rb
+++ b/spec/helpers/gitlab_markdown_helper_spec.rb
@@ -208,6 +208,40 @@ describe GitlabMarkdownHelper do
gfm(actual).should match(expected)
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
describe "#link_to_gfm" do