summaryrefslogtreecommitdiff
path: root/spec/paragraph_spec.rb
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2022-04-14 23:49:19 -0600
committerDan Allen <dan.j.allen@gmail.com>2022-04-15 01:59:34 -0600
commit806cb4d9e55ae38c3b7f5d18999a797fb9f16b1e (patch)
treed334a0d48b85c6a9f17d5145986f717b4c266aa8 /spec/paragraph_spec.rb
parent01f11a7dcf323c9fb5ab18aa269302c4d0e08ec1 (diff)
add support for line-height property on lead role as documented
Diffstat (limited to 'spec/paragraph_spec.rb')
-rw-r--r--spec/paragraph_spec.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/paragraph_spec.rb b/spec/paragraph_spec.rb
index 7a4a622a..570a3149 100644
--- a/spec/paragraph_spec.rb
+++ b/spec/paragraph_spec.rb
@@ -117,4 +117,41 @@ describe 'Asciidoctor::PDF::Converter - Paragraph' do
(expect title_text[:x]).to be > center_x
(expect paragraph_text[:x]).to be > center_x
end
+
+ it 'should apply the lead style to a paragraph with the lead role' do
+ pdf = to_pdf <<~'EOS', analyze: true
+ = Document Title
+
+ preamble content
+
+ [.lead]
+ more preamble content
+
+ == First Section
+
+ section content
+ EOS
+
+ preamble_text = pdf.find_text 'preamble content'
+ (expect preamble_text).to have_size 1
+ (expect preamble_text[0][:font_size]).to be 13
+ more_preamble_text = pdf.find_text 'more preamble content'
+ (expect more_preamble_text).to have_size 1
+ (expect more_preamble_text[0][:font_size]).to be 13
+ end
+
+ it 'should allow the theme to control the line height of a lead paragraph' do
+ input = <<~EOS
+ [.lead]
+ #{lorem_ipsum '2-sentences-1-paragraph'}
+ EOS
+
+ reference_texts = (to_pdf input, analyze: true).text
+ default_spacing = reference_texts[0][:y] - reference_texts[1][:y]
+
+ texts = (to_pdf input, pdf_theme: { lead_line_height: 2 }, analyze: true).text
+ adjusted_spacing = texts[0][:y] - texts[1][:y]
+
+ (expect adjusted_spacing).to be > default_spacing
+ end
end