summaryrefslogtreecommitdiff
path: root/test/lists_test.rb
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2023-04-22 23:13:27 -0600
committerGitHub <noreply@github.com>2023-04-22 23:13:27 -0600
commit0ef6afea4ea85faa3e5591717683bbac04b3d8b2 (patch)
tree65b2a23ed169ec7c777c5e593674bb1268dc2849 /test/lists_test.rb
parent4a70aa35b6942136e5238bd3d568b7ae9927b716 (diff)
resolves #4268 implicitly attach nested list that starts with block attribute lines to dlist entry (PR #4439)
Diffstat (limited to 'test/lists_test.rb')
-rw-r--r--test/lists_test.rb83
1 files changed, 83 insertions, 0 deletions
diff --git a/test/lists_test.rb b/test/lists_test.rb
index bc9de773..857dbef5 100644
--- a/test/lists_test.rb
+++ b/test/lists_test.rb
@@ -4155,6 +4155,89 @@ context 'Description lists redux' do
assert_xpath '//*[@class="dlist"]/following-sibling::*[@class="paragraph"]', output, 1
assert_xpath '//*[@class="dlist"]/following-sibling::*[@class="paragraph"]/p[text()="detached"]', output, 1
end
+
+ test 'block attribute lines above nested horizontal list does not break list' do
+ input = <<~'EOS'
+ Operating Systems::
+ [horizontal]
+ Linux::: Fedora
+ BSD::: OpenBSD
+
+ Cloud Providers::
+ PaaS::: OpenShift
+ IaaS::: AWS
+ EOS
+
+ output = convert_string_to_embedded input
+ assert_xpath '//dl', output, 2
+ assert_xpath '/*[@class="dlist"]/dl', output, 1
+ assert_xpath '(//dl)[1]/dd', output, 2
+ assert_xpath '((//dl)[1]/dd)[1]//table', output, 1
+ assert_xpath '((//dl)[1]/dd)[2]//table', output, 0
+ end
+
+ test 'block attribute lines above nested list with style does not break list' do
+ input = <<~'EOS'
+ TODO List::
+ * get groceries
+ Grocery List::
+ [square]
+ * bread
+ * milk
+ * lettuce
+ EOS
+
+ output = convert_string_to_embedded input
+ assert_xpath '//dl', output, 1
+ assert_xpath '(//dl)[1]/dd', output, 2
+ assert_xpath '((//dl)[1]/dd)[2]//ul[@class="square"]', output, 1
+ end
+
+ test 'multiple block attribute lines above nested list does not break list' do
+ input = <<~'EOS'
+ Operating Systems::
+ [[variants]]
+ [horizontal]
+ Linux::: Fedora
+ BSD::: OpenBSD
+
+ Cloud Providers::
+ PaaS::: OpenShift
+ IaaS::: AWS
+ EOS
+
+ output = convert_string_to_embedded input
+ assert_xpath '//dl', output, 2
+ assert_xpath '/*[@class="dlist"]/dl', output, 1
+ assert_xpath '(//dl)[1]/dd', output, 2
+ assert_xpath '(//dl)[1]/dd/*[@id="variants"]', output, 1
+ assert_xpath '((//dl)[1]/dd)[1]//table', output, 1
+ assert_xpath '((//dl)[1]/dd)[2]//table', output, 0
+ end
+
+ test 'multiple block attribute lines separated by empty line above nested list does not break list' do
+ input = <<~'EOS'
+ Operating Systems::
+ [[variants]]
+
+ [horizontal]
+
+ Linux::: Fedora
+ BSD::: OpenBSD
+
+ Cloud Providers::
+ PaaS::: OpenShift
+ IaaS::: AWS
+ EOS
+
+ output = convert_string_to_embedded input
+ assert_xpath '//dl', output, 2
+ assert_xpath '/*[@class="dlist"]/dl', output, 1
+ assert_xpath '(//dl)[1]/dd', output, 2
+ assert_xpath '(//dl)[1]/dd/*[@id="variants"]', output, 1
+ assert_xpath '((//dl)[1]/dd)[1]//table', output, 1
+ assert_xpath '((//dl)[1]/dd)[2]//table', output, 0
+ end
end
context 'Item with text inline' do