diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/fixtures/b/doc-b.adoc | 4 | ||||
-rw-r--r-- | spec/integration_spec.rb | 23 |
2 files changed, 27 insertions, 0 deletions
diff --git a/spec/fixtures/b/doc-b.adoc b/spec/fixtures/b/doc-b.adoc index 4f24989..3c4167c 100644 --- a/spec/fixtures/b/doc-b.adoc +++ b/spec/fixtures/b/doc-b.adoc @@ -1,3 +1,7 @@ = Document B xref:c/doc-c.adoc#[] + +|=== +a| xref:../doc-a.adoc#[] +|=== diff --git a/spec/integration_spec.rb b/spec/integration_spec.rb index 19655bf..ede62ed 100644 --- a/spec/integration_spec.rb +++ b/spec/integration_spec.rb @@ -64,6 +64,29 @@ describe 'Intengration Tests' do end end + # Issue #3 + context 'when xref is inside a nested document' do + it 'renders title of the referenced document as reftext' do + given <<~ADOC + |=== + a| xref:doc-a.adoc#[] + |=== + ADOC + should have_anchor href: 'doc-a.html', text: 'Document A' + end + + context 'with relative path' do + subject(:output) do + opts = options.except(:base_dir).merge(safe: :unsafe) + Asciidoctor.load_file("#{FIXTURES_DIR}/b/doc-b.adoc", opts).convert + end + + it 'resolves path relative to the current document' do + should have_anchor href: '../doc-a.html', text: 'Document A' + end + end + end + context 'when extension is not active' do specify 'renders path of the referenced document as reftext' do given 'xref:doc-a.adoc#[]', extensions: [] |