diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2022-10-22 02:19:19 -0600 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2022-10-22 02:26:23 -0600 |
| commit | 09f8c3a8d7a19f3ca2f0f4cdb14a00e746cbd9fa (patch) | |
| tree | 6ebf278b2d4d5996e83e84b20d388f0e73bd090f /spec/section_spec.rb | |
| parent | 1ed32449448260fd3b29bc47590e64e8a9fa0ca0 (diff) | |
verify trailing hard line break is ignored
Diffstat (limited to 'spec/section_spec.rb')
| -rw-r--r-- | spec/section_spec.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/section_spec.rb b/spec/section_spec.rb index 842250d7..1cb192b4 100644 --- a/spec/section_spec.rb +++ b/spec/section_spec.rb @@ -49,6 +49,35 @@ describe 'Asciidoctor::PDF::Converter - Section' do (expect pdf.text.map {|it| it.values_at :string, :font_name }).to eql expected_text end + it 'should apply text formatting in section title' do + pdf = to_pdf <<~'EOS', analyze: true + == Section Title with Some _Oomph_ + + text + EOS + + (expect pdf.lines[0]).to eql 'Section Title with Some Oomph' + text_with_emphasis = pdf.find_unique_text 'Oomph' + (expect text_with_emphasis).not_to be_nil + (expect text_with_emphasis[:font_name]).to end_with 'Italic' + end + + it 'should ignore hard line break at end of section title' do + pdf = to_pdf <<~'EOS', analyze: true + == Reference Title + + reference text + + == Section Title + + + section text + EOS + + expected_gap = ((pdf.find_unique_text 'Reference Title')[:y] - (pdf.find_unique_text 'reference text')[:y]).round 4 + actual_gap = ((pdf.find_unique_text 'Section Title')[:y] - (pdf.find_unique_text 'section text')[:y]).round 4 + (expect actual_gap).to eql expected_gap + end + it 'should allow theme to set font family for headings' do pdf_theme = { heading_font_family: 'Helvetica', |
