summaryrefslogtreecommitdiff
path: root/spec/xref_spec.rb
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2019-10-07 23:58:23 -0600
committerDan Allen <dan.j.allen@gmail.com>2019-10-08 00:11:13 -0600
commit6a38339df98db17dd577646b488ff0d1e242ff84 (patch)
tree89cacee101d348e213024d064ddd5277b3be9ceb /spec/xref_spec.rb
parent6eb3591ad062b5f9559b6e10490199be3f22894a (diff)
add tests to verify behavior when xref cannot be resolved or has no xreftext
Diffstat (limited to 'spec/xref_spec.rb')
-rw-r--r--spec/xref_spec.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/xref_spec.rb b/spec/xref_spec.rb
index 73b0f1f1..3030da3d 100644
--- a/spec/xref_spec.rb
+++ b/spec/xref_spec.rb
@@ -147,6 +147,19 @@ describe 'Asciidoctor::PDF::Converter - Xref' do
(expect (pdf.page 1).text).to include '[first-cell]'
end
end
+
+ it 'should show ID enclosed in square brackets if reference cannot be resolved' do
+ pdf = to_pdf <<~'EOS'
+ Road to <<nowhere>>.
+ EOS
+
+ (expect (pdf.page 1).text).to eq 'Road to [nowhere].'
+ names = get_names pdf
+ (expect names).not_to have_key 'nowhere'
+ annotations = get_annotations pdf, 1
+ (expect annotations).to have_size 1
+ (expect annotations[0][:Dest]).to eql 'nowhere'
+ end
end
context 'interdocument' do
@@ -247,5 +260,24 @@ describe 'Asciidoctor::PDF::Converter - Xref' do
(expect pdf.lines[0]).to eql 'See Figure 1.'
end if asciidoctor_1_5_7_or_better?
+
+ it 'should show ID of reference enclosed in square brackets if reference has no xreftext' do
+ pdf = to_pdf <<~'EOS'
+ :xrefstyle: full
+
+ Jump to the <<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'
+ (expect (pdf.page 1).text).to include '[first-item]'
+ end
end
end