diff options
| author | Owen Heisler <owenh000@gmail.com> | 2018-07-31 00:24:23 -0500 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2018-07-30 23:24:23 -0600 |
| commit | fc72cf631bcfbcada8873d2f419bd13e199fcae3 (patch) | |
| tree | 9ced8e6cfbab44d76ac7d41dd0a967e2cce9a5ee /test | |
| parent | 2398cc1c51f1f040400e8c98f7d9b41621748717 (diff) | |
resolves #2812 catalog inline anchors in ordered lists (PR #2813)
* Catalog anchors in ordered list items
* Add test to validate olist anchors are cataloged
* Add entry to CHANGELOG
Diffstat (limited to 'test')
| -rw-r--r-- | test/lists_test.rb | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/test/lists_test.rb b/test/lists_test.rb index ce421447..483d819a 100644 --- a/test/lists_test.rb +++ b/test/lists_test.rb @@ -766,7 +766,7 @@ B. And it ends here. assert_xpath '//ol/li', output, 2 end - test 'should discover anchor at start of list item text and register it as a reference' do + test 'should discover anchor at start of unordered list item text and register it as a reference' do input = <<-EOS The highest peak in the Front Range is <<grays-peak>>, which tops <<mount-evans>> by just a few feet. @@ -785,6 +785,26 @@ Grays Peak rises to 14,278 feet, making it the highest summit in the Front Range assert_xpath '(//p)[1]/a[@href="#grays-peak"][text()="Grays Peak"]', output, 1 assert_xpath '(//p)[1]/a[@href="#mount-evans"][text()="Mount Evans"]', output, 1 end + + test 'should discover anchor at start of ordered list item text and register it as a reference' do + input = <<-EOS +This is a cross-reference to <<step-2>>. +This is a cross-reference to <<step-4>>. + +. Ordered list, item 1, without anchor +. [[step-2,Step 2]]Ordered list, item 2, with anchor +. Ordered list, item 3, without anchor +. [[step-4,Step 4]]Ordered list, item 4, with anchor + EOS + + doc = document_from_string input + refs = doc.catalog[:refs] + assert refs.key?('step-2') + assert refs.key?('step-4') + output = doc.convert :header_footer => false + assert_xpath '(//p)[1]/a[@href="#step-2"][text()="Step 2"]', output, 1 + assert_xpath '(//p)[1]/a[@href="#step-4"][text()="Step 4"]', output, 1 + end end context "Nested lists" do |
