commit
4f8a4aa44c
852 changed files with 121 additions and 48 deletions
|
@ -208,6 +208,46 @@ 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 "sets height and width" do
|
||||
actual = gfm(":+1:")
|
||||
actual.should match(/width="20"/)
|
||||
actual.should match(/height="20"/)
|
||||
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
|
||||
|
|
|
@ -35,6 +35,16 @@ describe Note do
|
|||
note = Factory(:note, note: "-1 for this")
|
||||
note.should_not be_upvote
|
||||
end
|
||||
|
||||
it "recognizes a +1 emoji as a vote" do
|
||||
note = build(:note, note: ":+1: for this")
|
||||
note.should be_upvote
|
||||
end
|
||||
|
||||
it "recognizes a neutral emoji note" do
|
||||
note = build(:note, note: "I would :+1: this, but I don't want to")
|
||||
note.should_not be_upvote
|
||||
end
|
||||
end
|
||||
|
||||
let(:project) { create(:project) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue