diff options
author | Willian Balmant <willchb@gmail.com> | 2019-04-10 20:50:26 +0000 |
---|---|---|
committer | Willian Balmant <willchb@gmail.com> | 2019-04-10 20:50:26 +0000 |
commit | 2075ef7d071286ad156ca13640336572bb20bceb (patch) | |
tree | 6c69724887832bab8d34943f15a05889a7967948 /spec/lib/banzai | |
parent | b6ca523cf7b8f7339d13d730c9fa24e7cac3263b (diff) | |
download | gitlab-ce-2075ef7d071286ad156ca13640336572bb20bceb.tar.gz |
No leading/trailing spaces when generating heading ids (Fixes #57528)
Update based on comments in MR #27025
Diffstat (limited to 'spec/lib/banzai')
-rw-r--r-- | spec/lib/banzai/filter/table_of_contents_filter_spec.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/lib/banzai/filter/table_of_contents_filter_spec.rb b/spec/lib/banzai/filter/table_of_contents_filter_spec.rb index 7213cd58ea7..f776e21a89e 100644 --- a/spec/lib/banzai/filter/table_of_contents_filter_spec.rb +++ b/spec/lib/banzai/filter/table_of_contents_filter_spec.rb @@ -58,6 +58,11 @@ describe Banzai::Filter::TableOfContentsFilter do expect(doc.css('h1 a').first.attr('href')).to eq '#this-header-is-filled-with-punctuation' end + it 'removes any leading or trailing spaces' do + doc = filter(header(1, " \r\n \t Title with spaces \r\n\t ")) + expect(doc.css('h1 a').first.attr('href')).to eq '#title-with-spaces' + end + it 'appends a unique number to duplicates' do doc = filter(header(1, 'One') + header(2, 'One')) |