summaryrefslogtreecommitdiff
path: root/spec/index_spec.rb
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2020-04-26 23:55:18 -0600
committerGitHub <noreply@github.com>2020-04-26 23:55:18 -0600
commit54d6cedd4962be003308ec906af6d802171ab022 (patch)
tree09d1f2bf3db9b2fdc5187b39b0c10e4b717b2a23 /spec/index_spec.rb
parent05854663c3636ebd5db07848717800f1958881c2 (diff)
resolves #1665 do not insert blank line in index when term is forced to break (PR #1666)
Diffstat (limited to 'spec/index_spec.rb')
-rw-r--r--spec/index_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/index_spec.rb b/spec/index_spec.rb
index 9221c68b..b52a93c7 100644
--- a/spec/index_spec.rb
+++ b/spec/index_spec.rb
@@ -390,4 +390,24 @@ describe 'Asciidoctor::PDF::Converter - Index' do
hanging_indent = begin_text[:x] - fun_profit_text[:x]
(expect hanging_indent.round).to eql (level_indent * 2).round
end
+
+ it 'should not insert blank line if index term is forced to break' do
+ pdf = to_pdf <<~'EOS', analyze: true
+ = Document Title
+ :doctype: book
+ :notitle:
+
+ text(((flags,SHORT_FLAG)))(((flags,SUPER_LONG_FLAG_THAT_IS_FORCED_TO_BREAK)))
+
+ [index]
+ == Index
+ EOS
+
+ flags_text = (pdf.find_text 'flags', page_number: 2)[0]
+ short_flag_text = (pdf.find_text %r/^SHORT_FLAG/, page_number: 2)[0]
+ long_flag_text = (pdf.find_text %r/^SUPER_LONG_FLAG/, page_number: 2)[0]
+ line_gap = (flags_text[:y] - short_flag_text[:y]).round 2
+ (expect short_flag_text[:x]).to eql long_flag_text[:x]
+ (expect (short_flag_text[:y] - long_flag_text[:y]).round 2).to eql line_gap
+ end
end