diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2022-03-04 23:54:07 -0700 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2022-03-05 02:24:19 -0700 |
| commit | a36e5afaef6bd200cdb1bfaea55ae670ad5a2d7c (patch) | |
| tree | b32e6453bc0df4ddce096dfb61a10e1874ea4d99 /spec/admonition_spec.rb | |
| parent | 1bec943dfad7260555b1c6079fe3d5fac4574af6 (diff) | |
add helper to retrieve metadata for destination
Diffstat (limited to 'spec/admonition_spec.rb')
| -rw-r--r-- | spec/admonition_spec.rb | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/spec/admonition_spec.rb b/spec/admonition_spec.rb index 970b42fb..d547b565 100644 --- a/spec/admonition_spec.rb +++ b/spec/admonition_spec.rb @@ -30,10 +30,8 @@ describe 'Asciidoctor::PDF::Converter - Admonition' do pdf_theme = { block_margin_top: 10 } lines = (to_pdf input, pdf_theme: pdf_theme, analyze: :line).lines pdf = to_pdf input, pdf_theme: pdf_theme - names = get_names pdf - (expect names).to have_key 'admon-1' - dest = pdf.objects[names['admon-1']] - (expect dest[3]).to eql lines[0][:from][:y] + 10 + (expect (dest = get_dest pdf, 'admon-1')).not_to be_nil + (expect dest[:y]).to eql lines[0][:from][:y] + 10 end it 'should keep anchor with block if block is advanced to next page' do @@ -49,11 +47,9 @@ describe 'Asciidoctor::PDF::Converter - Admonition' do pdf_theme = { block_margin_top: 10 } lines = (to_pdf input, pdf_theme: pdf_theme, analyze: :line).lines pdf = to_pdf input, pdf_theme: pdf_theme - names = get_names pdf - (expect names).to have_key 'admon-1' - dest = pdf.objects[names['admon-1']] - (expect get_page_number pdf, dest[0]).to be 2 - (expect dest[3]).to eql lines[0][:from][:y] + (expect (dest = get_dest pdf, 'admon-1')).not_to be_nil + (expect dest[:page_number]).to be 2 + (expect dest[:y]).to eql lines[0][:from][:y] end it 'should vertically center label on first page if block is split across pages' do |
