diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2022-04-17 04:26:58 -0600 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2022-04-17 04:26:58 -0600 |
| commit | f50f1fc01f183c5894c1597ddca151ef86588034 (patch) | |
| tree | 48cea58c745e447550995ca43a5eae2ff500e3b6 | |
| parent | b4c6591c82526ae1c657a533c2eefdb904c9d1aa (diff) | |
verify fix for #907 do not increment counter more times than expected
| -rw-r--r-- | spec/admonition_spec.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/admonition_spec.rb b/spec/admonition_spec.rb index 5d8c2d97..cc676b0c 100644 --- a/spec/admonition_spec.rb +++ b/spec/admonition_spec.rb @@ -222,6 +222,39 @@ describe 'Asciidoctor::PDF::Converter - Admonition' do (expect text[:y]).to eql reference_text[:y] end + it 'should not increment counter in admonition content more times than expected' do + pdf = to_pdf <<~'EOS', analyze: true + == Initial value + + Current number is {counter:my-count:0}. + + == One is expected + + Current number is {counter:my-count}. + + == Two is expected + + Current number is {counter:my-count}. + + == Three is expected + + NOTE: Current number is {counter:my-count}. + + == Four is expected + + [%unbreakable] + CAUTION: Current number is {counter:my-count}. + + == Five is expected + + Current number is {counter:my-count}. + EOS + + expected = (0.upto 5).map {|it| %(Current number is #{it}.) } + number_texts = pdf.find_text %r/^Current number is/ + (expect number_texts.map {|it| it[:string] }).to eql expected + end + context 'Text' do it 'should show admonition label in bold by default' do pdf = to_pdf <<~'EOS', analyze: true |
