Skip to content

Commit

Permalink
Added tests for the convert_olist() method.
Browse files Browse the repository at this point in the history
  • Loading branch information
jhradilek committed Nov 12, 2024
1 parent 5b1e031 commit ea02570
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions test/test_olist.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
require 'minitest/autorun'
require_relative 'helper'

class OlistTest < Minitest::Test
def test_simple_ordered_list
xml = <<~EOF.chomp.to_dita
. Item one
. Item two
EOF

assert_xpath_equal xml, 'Item one', '//ol/li[1]/text()'
assert_xpath_equal xml, 'Item two', '//ol/li[2]/text()'
end

def test_compound_ordered_list
xml = <<~EOF.chomp.to_dita
. Item one
+
Additional paragraph
. Item two
EOF

assert_xpath_equal xml, 'Item one', '//ol/li[1]/p[1]/text()'
assert_xpath_equal xml, 'Additional paragraph', '//ol/li[1]/p[2]/text()'
end

def test_ordered_list_title
xml = <<~EOF.chomp.to_dita
.An ordered list title
. Item one
. Item two
EOF

assert_xpath_equal xml, 'An ordered list title', '//p[@outputclass="title"]/b/text()'
assert_xpath_count xml, 2, '//ol/li'
end
end

0 comments on commit ea02570

Please sign in to comment.