summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorpanjan <panjan@panjan.cz>2016-09-30 11:03:16 +0200
committerSean McGivern <sean@gitlab.com>2016-11-01 09:49:30 +0000
commit6b4c6fa193d1f831e272b03cec605e702069770c (patch)
tree6809014d9116ac7b24453b9962375a66cce145b9 /spec/support
parent266fcfb1935c8aa8c6ac3d2ae71530c441b08675 (diff)
downloadgitlab-ce-6b4c6fa193d1f831e272b03cec605e702069770c.tar.gz
Fix Markdown styling inside reference links
Fixes: https://gitlab.com/gitlab-org/gitlab-ce/issues/18096
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/banzai/reference_filter_shared_examples.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/support/banzai/reference_filter_shared_examples.rb b/spec/support/banzai/reference_filter_shared_examples.rb
new file mode 100644
index 00000000000..eb5da662ab5
--- /dev/null
+++ b/spec/support/banzai/reference_filter_shared_examples.rb
@@ -0,0 +1,13 @@
+# Specs for reference links containing HTML.
+#
+# Requires a reference:
+# let(:reference) { '#42' }
+shared_examples 'a reference containing an element node' do
+ let(:inner_html) { 'element <code>node</code> inside' }
+ let(:reference_with_element) { %{<a href="#{reference}">#{inner_html}</a>} }
+
+ it 'does not escape inner html' do
+ doc = reference_filter(reference_with_element)
+ expect(doc.children.first.inner_html).to eq(inner_html)
+ end
+end