summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2022-05-11 17:32:25 -0600
committerGitHub <noreply@github.com>2022-05-11 17:32:25 -0600
commit31f5e9f226a38d4c55bf89f043f305661a667584 (patch)
tree89b290cd894411dfa3d8d3747a45d3629c07ada5 /spec
parent6a91de0db46c2715527140c70c0a9e17df7c358a (diff)
resolves #2158 do not orphan sidebar title (PR #2159)
Diffstat (limited to 'spec')
-rw-r--r--spec/sidebar_spec.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/sidebar_spec.rb b/spec/sidebar_spec.rb
index a64616b3..71519c6f 100644
--- a/spec/sidebar_spec.rb
+++ b/spec/sidebar_spec.rb
@@ -157,6 +157,37 @@ describe 'Asciidoctor::PDF::Converter - Sidebar' do
(expect sidebar_text[:page_number]).to be 2
end
+ it 'should keep title with content when block is advanced to next page' do
+ pdf_theme = {
+ sidebar_border_radius: 0,
+ sidebar_border_width: 0,
+ sidebar_background_color: 'DFDFDF',
+ }
+ pdf = with_content_spacer 10, 680 do |spacer_path|
+ to_pdf <<~EOS, pdf_theme: pdf_theme, analyze: true
+ image::#{spacer_path}[]
+
+ .Sidebar Title
+ ****
+
+ First block of content.
+ ****
+ EOS
+ end
+
+ pages = pdf.pages
+ (expect pages).to have_size 2
+ title_text = pdf.find_unique_text 'Sidebar Title'
+ content_text = pdf.find_unique_text 'First block of content.'
+ (expect title_text[:page_number]).to be 2
+ (expect content_text[:page_number]).to be 2
+ (pdf.extract_graphic_states pages[0][:raw_content]).each do |p1_gs|
+ (expect p1_gs).not_to include '0.87451 0.87451 0.87451 scn'
+ end
+ p2_gs = (pdf.extract_graphic_states pages[1][:raw_content])[0]
+ (expect p2_gs).to have_background color: 'DFDFDF', top_left: [48.24, 805.89], bottom_right: [547.04, 737.63]
+ end
+
it 'should split block if it cannot fit on one page' do
pdf = to_pdf <<~EOS, analyze: true
.Sidebar Title