diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2019-08-19 23:57:43 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-08-19 23:57:43 -0600 |
| commit | 3ea2aa4d177b27a70b486e2e028ba3ee2bc5b933 (patch) | |
| tree | e0316e0b855a5c7759580dfe328e89e62309dcd3 /spec/section_spec.rb | |
| parent | b0711db84fbfb4eca461bd8c8e566edaf0371534 (diff) | |
resolves #1210 allow theme to control min height required after section (PR #1220)
- allow theme to control min height required after section to keep on same page
- don't shift section to next page if requirement isn't met and section is empty
Diffstat (limited to 'spec/section_spec.rb')
| -rw-r--r-- | spec/section_spec.rb | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/spec/section_spec.rb b/spec/section_spec.rb index 40cec9a1..26d38dee 100644 --- a/spec/section_spec.rb +++ b/spec/section_spec.rb @@ -273,6 +273,56 @@ describe 'Asciidoctor::PDF::Converter - Section' do (expect text[2][:font_size]).to eql 10.5 end + it 'should not force title of empty section to next page if it fits on page' do + pdf = to_pdf <<~EOS, analyze: true + == Section A + + [%hardbreaks] + #{(['filler'] * 41).join ?\n} + + == Section B + EOS + + section_b_text = (pdf.find_text 'Section B')[0] + (expect section_b_text[:page_number]).to eql 1 + end + + it 'should force section title to next page to keep with first line of section content' do + pdf = to_pdf <<~EOS, analyze: true + == Section A + + [%hardbreaks] + #{(['filler'] * 41).join ?\n} + + == Section B + + content + EOS + + section_b_text = (pdf.find_text 'Section B')[0] + (expect section_b_text[:page_number]).to eql 2 + content_text = (pdf.find_text 'content')[0] + (expect content_text[:page_number]).to eql 2 + end + + it 'should not force section title to next page to keep with content if heading_min_height_after is zero' do + pdf = to_pdf <<~EOS, pdf_theme: { heading_min_height_after: 0 }, analyze: true + == Section A + + [%hardbreaks] + #{(['filler'] * 41).join ?\n} + + == Section B + + content + EOS + + section_b_text = (pdf.find_text 'Section B')[0] + (expect section_b_text[:page_number]).to eql 1 + content_text = (pdf.find_text 'content')[0] + (expect content_text[:page_number]).to eql 2 + end + it 'should not add break before chapter if break-before key in theme is auto' do pdf = to_pdf <<~'EOS', pdf_theme: { heading_chapter_break_before: 'auto' }, analyze: true = Document Title |
