-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added tests for the compose_qanda_dlist() method.
- Loading branch information
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
require 'minitest/autorun' | ||
require_relative 'helper' | ||
|
||
class QuandaDlistTest < Minitest::Test | ||
def test_simple_qanda_list | ||
xml = <<~EOF.chomp.to_dita | ||
[qanda] | ||
Question 1:: Answer one | ||
Question 2:: Answer two | ||
EOF | ||
|
||
assert_xpath_equal xml, 'Question 1', '//ol/li[1]/p[1][@outputclass="question"]/i/text()' | ||
assert_xpath_equal xml, 'Answer one', '//ol/li[1]/p[2]/text()' | ||
assert_xpath_equal xml, 'Question 2', '//ol/li[2]/p[1][@outputclass="question"]/i/text()' | ||
assert_xpath_equal xml, 'Answer two', '//ol/li[2]/p[2]/text()' | ||
end | ||
|
||
def test_doubled_quanda_list | ||
xml = <<~EOF.chomp.to_dita | ||
[qanda] | ||
Question 1:: | ||
Question 2:: | ||
Answer one | ||
Question 3:: | ||
Answer two | ||
EOF | ||
|
||
assert_xpath_equal xml, 'Question 1', '//ol/li[1]/p[1][@outputclass="question"]/i/text()' | ||
assert_xpath_equal xml, 'Question 2', '//ol/li[1]/p[2][@outputclass="question"]/i/text()' | ||
assert_xpath_equal xml, 'Answer one', '//ol/li[1]/p[3]/text()' | ||
assert_xpath_equal xml, 'Question 3', '//ol/li[2]/p[1][@outputclass="question"]/i/text()' | ||
assert_xpath_equal xml, 'Answer two', '//ol/li[2]/p[2]/text()' | ||
end | ||
|
||
def test_qanda_list_title | ||
xml = <<~EOF.chomp.to_dita | ||
.A quanda list title | ||
[qanda] | ||
Question 1:: Answer one | ||
Question 2:: Answer two | ||
EOF | ||
|
||
assert_xpath_equal xml, 'A quanda list title', '//p[@outputclass="title"]/b/text()' | ||
assert_xpath_count xml, 2, '//ol/li' | ||
end | ||
end |