summaryrefslogtreecommitdiff
path: root/spec/section_spec.rb
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2020-08-13 23:59:30 -0600
committerDan Allen <dan.j.allen@gmail.com>2020-08-14 02:31:52 -0600
commit9d1e84ffbe1d78a9f750cc04dd4f6f53e49d97cb (patch)
treedec343a719d27138b0dc7c2b0f557c48d15173de /spec/section_spec.rb
parentd45c15e2bf209e65b4c27c62542306a9a140792b (diff)
verify theme can set different top of page margin for a given heading level (e.g., part)
Diffstat (limited to 'spec/section_spec.rb')
-rw-r--r--spec/section_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/section_spec.rb b/spec/section_spec.rb
index 552ecde7..29370697 100644
--- a/spec/section_spec.rb
+++ b/spec/section_spec.rb
@@ -209,6 +209,34 @@ describe 'Asciidoctor::PDF::Converter - Section' do
(expect y1).to be > y2
end
+ it 'should allow theme to specify different top margin for part titles' do
+ pdf_theme = {
+ heading_h1_font_size: 20,
+ heading_h1_margin_page_top: 100,
+ heading_h2_font_size: 20,
+ }
+ pdf = to_pdf <<~'EOS', pdf_theme: pdf_theme, analyze: true
+ = Document Title
+ :doctype: book
+
+ = Part A
+
+ == First Chapter
+
+ content
+
+ = Part B
+
+ == Last Chapter
+
+ content
+ EOS
+
+ part_a_text = pdf.find_unique_text 'Part A'
+ first_chapter_text = pdf.find_unique_text 'First Chapter'
+ (expect part_a_text[:y]).to eql first_chapter_text[:y] - 100.0
+ end
+
it 'should uppercase section titles if text_transform key in theme is set to uppercase' do
pdf = to_pdf <<~'EOS', pdf_theme: { heading_text_transform: 'uppercase' }, analyze: true
= Document Title