Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Provaznik <jprovaznik@gitlab.com>2017-12-08 12:50:22 +0300
committerJan Provaznik <jprovaznik@gitlab.com>2017-12-08 16:13:18 +0300
commit3e83d9f73a2dbec010026dbcd24effe89d4dc16f (patch)
tree10bee33e10b0b469c018a8573e4d3162c485e3be /spec/lib/gitlab/reference_extractor_spec.rb
parent29e39e55c3d4b5c6c34c6faec84b0dcd5a3efffa (diff)
Use prefix for TableOfContents filter hrefs
TableOfContents filter generates hrefs for each header in markdown, if the header text consists from digits and redacted symbols only, e.g. "123" or "1.0 then the auto-generated href has the same format as issue references. If the generated id contains only digits, then 'anchor-' prefix is prepended to the id. Closes #38473
Diffstat (limited to 'spec/lib/gitlab/reference_extractor_spec.rb')
-rw-r--r--spec/lib/gitlab/reference_extractor_spec.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/lib/gitlab/reference_extractor_spec.rb b/spec/lib/gitlab/reference_extractor_spec.rb
index 476a3f1998d..bce0fa2ea8f 100644
--- a/spec/lib/gitlab/reference_extractor_spec.rb
+++ b/spec/lib/gitlab/reference_extractor_spec.rb
@@ -115,6 +115,15 @@ describe Gitlab::ReferenceExtractor do
end
end
+ it 'does not include anchors from table of contents in issue references' do
+ issue1 = create(:issue, project: project)
+ issue2 = create(:issue, project: project)
+
+ subject.analyze("not real issue <h4>#{issue1.iid}</h4>, real issue #{issue2.to_reference}")
+
+ expect(subject.issues).to match_array([issue2])
+ end
+
it 'accesses valid issue objects' do
@i0 = create(:issue, project: project)
@i1 = create(:issue, project: project)