summaryrefslogtreecommitdiff
path: root/test/blocks_test.rb
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2021-04-14 23:58:55 -0600
committerGitHub <noreply@github.com>2021-04-14 23:58:55 -0600
commit01aa1b564c202695d40d3d910aa6bd5dd0eeac5f (patch)
treed9c5d4293719223389f3d1a944358452574eb3a7 /test/blocks_test.rb
parent53b553cd3dde8ca2279fa19e3f3872b060545698 (diff)
resolves #4013 increment counter (but not the corresponding attribute) if attribute is locked (PR #4015)
Diffstat (limited to 'test/blocks_test.rb')
-rw-r--r--test/blocks_test.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/blocks_test.rb b/test/blocks_test.rb
index 0453f5e6..f7677730 100644
--- a/test/blocks_test.rb
+++ b/test/blocks_test.rb
@@ -804,6 +804,30 @@ context 'Blocks' do
assert_equal 'B', doc.attributes['example-number']
end
+ test 'should increment counter for example even when example-number is locked by the API' do
+ input = <<~'EOS'
+ .Writing Docs with AsciiDoc
+ ====
+ Here's how you write AsciiDoc.
+
+ You just write.
+ ====
+
+ .Writing Docs with DocBook
+ ====
+ Here's how you write DocBook.
+
+ You futz with XML.
+ ====
+ EOS
+
+ doc = document_from_string input, attributes: { 'example-number' => '`' }
+ output = doc.convert
+ assert_xpath '(//*[@class="exampleblock"])[1]/*[@class="title"][text()="Example a. Writing Docs with AsciiDoc"]', output, 1
+ assert_xpath '(//*[@class="exampleblock"])[2]/*[@class="title"][text()="Example b. Writing Docs with DocBook"]', output, 1
+ assert_equal 'b', doc.attributes['example-number']
+ end
+
test "explicit caption is used if provided" do
input = <<~'EOS'
[caption="Look! "]