summaryrefslogtreecommitdiff
path: root/spec/admonition_spec.rb
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2020-06-04 23:57:45 -0600
committerDan Allen <dan.j.allen@gmail.com>2020-06-05 01:09:09 -0600
commitd140e475b6ae368c50f12d7138727d8e3933f4bc (patch)
treede97ef0055bb4f1aead59bfe5d2bd4554b4a8cb4 /spec/admonition_spec.rb
parentfab2f081eeb5f937214a6f085da96177f92a5640 (diff)
test that singular admonition padding and label padding values are expanded
Diffstat (limited to 'spec/admonition_spec.rb')
-rw-r--r--spec/admonition_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/admonition_spec.rb b/spec/admonition_spec.rb
index 84f48426..9992580f 100644
--- a/spec/admonition_spec.rb
+++ b/spec/admonition_spec.rb
@@ -118,6 +118,24 @@ describe 'Asciidoctor::PDF::Converter - Admonition' do
(expect pdf.find_unique_text 'IMPORTANT').to be_nil
end
+ it 'should allow padding to be specified for label and content using single value' do
+ input = <<~'EOS'
+ [IMPORTANT]
+ Make sure the device is powered off before servicing it.
+ EOS
+
+ pdf = to_pdf input, pdf_theme: { admonition_padding: 0, admonition_label_padding: 0 }, analyze: true
+ ref_label_text = pdf.find_unique_text 'IMPORTANT'
+ ref_content_text = pdf.find_unique_text 'Make sure the device is powered off before servicing it.'
+
+ pdf = to_pdf input, pdf_theme: { admonition_padding: 10, admonition_label_padding: 10 }, analyze: true
+ label_text = pdf.find_unique_text 'IMPORTANT'
+ content_text = pdf.find_unique_text 'Make sure the device is powered off before servicing it.'
+
+ (expect label_text[:x] - ref_label_text[:x]).to eql 10.0
+ (expect content_text[:x] - ref_content_text[:x]).to eql 30.0
+ end
+
it 'should not move cursor below block if block ends at top of page' do
pdf = to_pdf <<~'EOS', analyze: true
top of page