summaryrefslogtreecommitdiff
path: root/spec/lib/banzai/pipeline/gfm_pipeline_spec.rb
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2019-06-06 17:49:08 +0100
committerSean McGivern <sean@gitlab.com>2019-06-07 10:05:57 +0100
commit1617aa27562c6c92c981cadf13f0fb999558e1cc (patch)
treefa2c5d328fb4d2f7f75dd174734b7caa341fa1a0 /spec/lib/banzai/pipeline/gfm_pipeline_spec.rb
parenta18b7e7e2b5d729a06bf109a5a0a7e42e19ecab4 (diff)
downloadgitlab-ce-1617aa27562c6c92c981cadf13f0fb999558e1cc.tar.gz
Allow emoji in label and milestone referencesallow-emoji-in-references
If we put the emoji filter before the reference filters, each emoji will have a wrapper element that prevents the reference filter from detecting the presence of the emoji. As the emoji filter now runs after the reference filters, references must contain a literal emoji, not the GitLab Flavored Markdown versions (:100`, for example). A weird side-effect is that if you have a label with the 100 emoji, and a label named :100:, then trying to reference the latter will work (link to the correct label), but will render with the 100 emoji. I'm comfortable with that edge case, I think.
Diffstat (limited to 'spec/lib/banzai/pipeline/gfm_pipeline_spec.rb')
-rw-r--r--spec/lib/banzai/pipeline/gfm_pipeline_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/lib/banzai/pipeline/gfm_pipeline_spec.rb b/spec/lib/banzai/pipeline/gfm_pipeline_spec.rb
index 91b0499375d..7119c826bca 100644
--- a/spec/lib/banzai/pipeline/gfm_pipeline_spec.rb
+++ b/spec/lib/banzai/pipeline/gfm_pipeline_spec.rb
@@ -117,4 +117,27 @@ describe Banzai::Pipeline::GfmPipeline do
expect(output).not_to include("javascript")
end
end
+
+ describe 'emoji in references' do
+ set(:project) { create(:project, :public) }
+ let(:emoji) { '💯' }
+
+ it 'renders a label reference with emoji inside' do
+ create(:label, project: project, name: emoji)
+
+ output = described_class.to_html("#{Label.reference_prefix}\"#{emoji}\"", project: project)
+
+ expect(output).to include(emoji)
+ expect(output).to include(Gitlab::Routing.url_helpers.project_issues_path(project, label_name: emoji))
+ end
+
+ it 'renders a milestone reference with emoji inside' do
+ milestone = create(:milestone, project: project, title: emoji)
+
+ output = described_class.to_html("#{Milestone.reference_prefix}\"#{emoji}\"", project: project)
+
+ expect(output).to include(emoji)
+ expect(output).to include(Gitlab::Routing.url_helpers.milestone_path(milestone))
+ end
+ end
end