diff options
author | Jan Provaznik <jprovaznik@gitlab.com> | 2017-12-08 10:50:22 +0100 |
---|---|---|
committer | Jan Provaznik <jprovaznik@gitlab.com> | 2017-12-08 14:13:18 +0100 |
commit | 3e83d9f73a2dbec010026dbcd24effe89d4dc16f (patch) | |
tree | 10bee33e10b0b469c018a8573e4d3162c485e3be /spec/lib/gitlab/reference_extractor_spec.rb | |
parent | 29e39e55c3d4b5c6c34c6faec84b0dcd5a3efffa (diff) | |
download | gitlab-ce-3e83d9f73a2dbec010026dbcd24effe89d4dc16f.tar.gz |
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.rb | 9 |
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) |