diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2023-03-26 02:43:00 -0600 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2023-03-27 03:11:17 -0600 |
| commit | e3bca28cc7fe871c96479376b4689f61d26e97eb (patch) | |
| tree | 52244a04ca6d449da5905e36923129e864c6e7a4 /spec | |
| parent | 8e18286a628b8195e44322add6fae048142184b6 (diff) | |
resolves #2379 restore bottom margin on table with breakable or unbreakable option
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/table_spec.rb | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/spec/table_spec.rb b/spec/table_spec.rb index 18eff273..77a308d1 100644 --- a/spec/table_spec.rb +++ b/spec/table_spec.rb @@ -3272,5 +3272,47 @@ describe 'Asciidoctor::PDF::Converter - Table' do table_dest = get_dest pdf, 't1' (expect table_dest[:page_number]).to be 2 end + + it 'should not collapse margin below table with %unbreakable option' do + pdf = to_pdf <<~END, analyze: true + before + + [%unbreakable] + |=== + | will not be broken + |=== + + after + END + + before_text = pdf.find_unique_text 'before' + table_text = pdf.find_unique_text 'will not be broken' + after_text = pdf.find_unique_text 'after' + margin_above = (before_text[:y] - table_text[:y]).round 2 + margin_below = (table_text[:y] - after_text[:y]).round 2 + (expect margin_below).to eql margin_above + end + + it 'should not collapse margin below table with %breakable option' do + pdf = to_pdf <<~END, pdf_theme: { caption_font_size: 10.5, table_cell_padding: 0 }, analyze: true + before + + .title + [%breakable] + |=== + | will not be separated from title + |=== + + after + END + + before_text = pdf.find_unique_text 'before' + title_text = pdf.find_unique_text 'Table 1. title' + table_text = pdf.find_unique_text 'will not be separated from title' + after_text = pdf.find_unique_text 'after' + margin_above = (before_text[:y] - title_text[:y]).round 2 + margin_below = (table_text[:y] - after_text[:y]).round 2 + (expect margin_below).to eql margin_above + end end end |
