diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2019-09-14 23:57:48 -0600 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2019-09-15 00:36:32 -0600 |
| commit | f5815ef551639e31ba32c28c1973417360c80ac0 (patch) | |
| tree | 4e254ba88ff07d25e358bcc1e3c09bf5ad6f252c /spec/xref_spec.rb | |
| parent | a8af37ed24883ae8d0ff75e8af138099b9a83b44 (diff) | |
verify reference can be made to table cell or list item with anchor
Diffstat (limited to 'spec/xref_spec.rb')
| -rw-r--r-- | spec/xref_spec.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/xref_spec.rb b/spec/xref_spec.rb index d497d94c..0ca3c923 100644 --- a/spec/xref_spec.rb +++ b/spec/xref_spec.rb @@ -103,6 +103,50 @@ describe 'Asciidoctor::PDF::Converter - Xref' do (expect annotations[0][:Dest]).to eql 'observed-values' (expect (pdf.page 2).text).to include 'table' end + + it 'should create reference to a list item with an anchor' do + pdf = to_pdf <<~'EOS' + Jump to the <<first-item>>. + + <<< + + * [[first-item,first item]]list item + EOS + + names = get_names pdf + (expect names).to have_key 'first-item' + annotations = get_annotations pdf, 1 + (expect annotations).to have_size 1 + (expect annotations[0][:Dest]).to eql 'first-item' + if asciidoctor_1_5_7_or_better? + (expect (pdf.page 1).text).to include 'first item' + else + (expect (pdf.page 1).text).to include '[first-item]' + end + end + + it 'should create reference to a table cell with an anchor' do + pdf = to_pdf <<~'EOS' + Jump to the <<first-cell>>. + + <<< + + |=== + |[[first-cell,first cell]]table cell + |=== + EOS + + names = get_names pdf + (expect names).to have_key 'first-cell' + annotations = get_annotations pdf, 1 + (expect annotations).to have_size 1 + (expect annotations[0][:Dest]).to eql 'first-cell' + if asciidoctor_1_5_7_or_better? + (expect (pdf.page 1).text).to include 'first cell' + else + (expect (pdf.page 1).text).to include '[first-cell]' + end + end end context 'interdocument' do |
