test/tables_test.rb in asciidoctor-1.5.6.2 vs test/tables_test.rb in asciidoctor-1.5.7
- old
+ new
@@ -19,11 +19,11 @@
doc = document_from_string input, :header_footer => false
table = doc.blocks[0]
assert 100, table.columns.map {|col| col.attributes['colpcwidth'] }.reduce(:+)
output = doc.convert
assert_css 'table', output, 1
- assert_css 'table.tableblock.frame-all.grid-all.spread', output, 1
+ assert_css 'table.tableblock.frame-all.grid-all.stretch', output, 1
assert_css 'table > colgroup > col[style*="width: 33.3333%"]', output, 2
assert_css 'table > colgroup > col:last-of-type[style*="width: 33.3334%"]', output, 1
assert_css 'table tr', output, 3
assert_css 'table > tbody > tr', output, 3
assert_css 'table td', output, 9
@@ -35,10 +35,24 @@
assert_xpath "(//tr)[#{rowi + 1}]/td[#{celli + 1}]/p[text()='#{cell}']", output, 1
}
}
end
+ test 'should set stripes class if stripes option is set' do
+ input = <<-EOS
+[stripes=odd]
+|=======
+|A |B |C
+|a |b |c
+|1 |2 |3
+|=======
+ EOS
+
+ output = render_embedded_string input
+ assert_css 'table.stripes-odd', output, 1
+ end
+
test 'renders caption on simple psv table' do
input = <<-EOS
.Simple psv table
|=======
|A |B |C
@@ -107,15 +121,15 @@
end
test 'preserves escaped delimiters at the end of the line' do
input = <<-EOS
[%header,cols="1,1"]
-|====
+|===
|A |B\\|
|A1 |B1\\|
|A2 |B2\\|
-|====
+|===
EOS
output = render_embedded_string input
assert_css 'table', output, 1
assert_css 'table > colgroup > col', output, 2
assert_css 'table > thead > tr', output, 1
@@ -128,15 +142,15 @@
assert_xpath '/table/tbody/tr[2]/td[2]/p[text()="B2|"]', output, 1
end
test 'should treat trailing pipe as an empty cell' do
input = <<-EOS
-|====
+|===
|A1 |
|B1 |B2
|C1 |C2
-|====
+|===
EOS
output = render_embedded_string input
assert_css 'table', output, 1
assert_css 'table > colgroup > col', output, 2
assert_css 'table > tbody > tr', output, 3
@@ -148,22 +162,27 @@
test 'should auto recover with warning if missing leading separator on first cell' do
input = <<-EOS
|===
A | here| a | there
+| x
+| y
+| z
+| end
|===
EOS
- output, warnings = redirect_streams {|_, err| [(render_embedded_string input), err.string] }
- assert_css 'table', output, 1
- assert_css 'table > colgroup > col', output, 4
- assert_css 'table > tbody > tr', output, 1
- assert_css 'table > tbody > tr > td', output, 4
- assert_xpath '/table/tbody/tr/td[1]/p[text()="A"]', output, 1
- assert_xpath '/table/tbody/tr/td[2]/p[text()="here"]', output, 1
- assert_xpath '/table/tbody/tr/td[3]/p[text()="a"]', output, 1
- assert_xpath '/table/tbody/tr/td[4]/p[text()="there"]', output, 1
- assert_includes warnings, 'table missing leading separator'
+ using_memory_logger do |logger|
+ output = render_embedded_string input
+ assert_css 'table', output, 1
+ assert_css 'table > tbody > tr', output, 2
+ assert_css 'table > tbody > tr > td', output, 8
+ assert_xpath '/table/tbody/tr[1]/td[1]/p[text()="A"]', output, 1
+ assert_xpath '/table/tbody/tr[1]/td[2]/p[text()="here"]', output, 1
+ assert_xpath '/table/tbody/tr[1]/td[3]/p[text()="a"]', output, 1
+ assert_xpath '/table/tbody/tr[1]/td[4]/p[text()="there"]', output, 1
+ assert_message logger, :ERROR, '<stdin>: line 2: table missing leading separator; recovering automatically', Hash
+ end
end
test 'performs normal substitutions on cell content' do
input = <<-EOS
:show_title: Cool new show
@@ -222,26 +241,95 @@
output = render_embedded_string input
result = xmlnodes_at_xpath('/table//div[@class="verse"]', output, 1)
assert_equal %(<div class="verse"> one\n two\nthree</div>), result.to_s
end
- test 'table and col width not assigned when autowidth option is specified' do
+ test 'table and column width not assigned when autowidth option is specified' do
input = <<-EOS
[options="autowidth"]
|=======
|A |B |C
|a |b |c
|1 |2 |3
|=======
EOS
output = render_embedded_string input
assert_css 'table', output, 1
+ assert_css 'table.fit-content', output, 1
assert_css 'table[style*="width"]', output, 0
assert_css 'table colgroup col', output, 3
- assert_css 'table colgroup col[width]', output, 0
+ assert_css 'table colgroup col[style*="width"]', output, 0
end
+ test 'does not assign column width for autowidth columns in HTML output' do
+ input = <<-EOS
+[cols="15%,3*~"]
+|=======
+|A |B |C |D
+|a |b |c |d
+|1 |2 |3 |4
+|=======
+ EOS
+ doc = document_from_string input
+ table_row0 = doc.blocks[0].rows.body[0]
+ assert_equal 15, table_row0[0].attributes['width']
+ assert_equal 15, table_row0[0].attributes['colpcwidth']
+ refute_equal '', table_row0[0].attributes['autowidth-option']
+ expected_pcwidths = { 1 => 28.3333, 2 => 28.3333, 3 => 28.3334 }
+ (1..3).each do |i|
+ assert_equal 28.3333, table_row0[i].attributes['width']
+ assert_equal expected_pcwidths[i], table_row0[i].attributes['colpcwidth']
+ assert_equal '', table_row0[i].attributes['autowidth-option']
+ end
+ output = doc.convert :header_footer => false
+ assert_css 'table', output, 1
+ assert_css 'table colgroup col', output, 4
+ assert_css 'table colgroup col[style]', output, 1
+ assert_css 'table colgroup col[style*="width: 15%"]', output, 1
+ end
+
+ test 'can assign autowidth to all columns even when table has a width' do
+ input = <<-EOS
+[cols="4*~",width=50%]
+|=======
+|A |B |C |D
+|a |b |c |d
+|1 |2 |3 |4
+|=======
+ EOS
+ doc = document_from_string input
+ table_row0 = doc.blocks[0].rows.body[0]
+ (0..3).each do |i|
+ assert_equal 25, table_row0[i].attributes['width']
+ assert_equal 25, table_row0[i].attributes['colpcwidth']
+ assert_equal '', table_row0[i].attributes['autowidth-option']
+ end
+ output = doc.convert :header_footer => false
+ assert_css 'table', output, 1
+ assert_css 'table[style*="width: 50%;"]', output, 1
+ assert_css 'table colgroup col', output, 4
+ assert_css 'table colgroup col[style]', output, 0
+ end
+
+ test 'equally distributes remaining column width to autowidth columns in DocBook output' do
+ input = <<-EOS
+[cols="15%,3*~"]
+|=======
+|A |B |C |D
+|a |b |c |d
+|1 |2 |3 |4
+|=======
+ EOS
+ output = render_embedded_string input, :backend => 'docbook5'
+ assert_css 'tgroup[cols="4"]', output, 1
+ assert_css 'tgroup colspec', output, 4
+ assert_css 'tgroup colspec[colwidth]', output, 4
+ assert_css 'tgroup colspec[colwidth="15*"]', output, 1
+ assert_css 'tgroup colspec[colwidth="28.3333*"]', output, 2
+ assert_css 'tgroup colspec[colwidth="28.3334*"]', output, 1
+ end
+
test 'explicit table width is used even when autowidth option is specified' do
input = <<-EOS
[%autowidth,width=75%]
|=======
|A |B |C
@@ -251,20 +339,20 @@
EOS
output = render_embedded_string input
assert_css 'table', output, 1
assert_css 'table[style*="width"]', output, 1
assert_css 'table colgroup col', output, 3
- assert_css 'table colgroup col[width]', output, 0
+ assert_css 'table colgroup col[style*="width"]', output, 0
end
test 'first row sets number of columns when not specified' do
input = <<-EOS
-|====
+|===
|first |second |third |fourth
|1 |2 |3
|4
-|====
+|===
EOS
output = render_embedded_string input
assert_css 'table', output, 1
assert_css 'table > colgroup > col', output, 4
assert_css 'table > tbody > tr', output, 2
@@ -390,10 +478,12 @@
assert_css 'table > tfoot', output, 1
assert_css 'table > tfoot > tr', output, 1
assert_css 'table > tfoot > tr > td', output, 2
assert_css 'table > tbody', output, 1
assert_css 'table > tbody > tr', output, 3
+ table_section_names = (xmlnodes_at_css 'table > *', output).map(&:node_name).select {|n| n.start_with? 't' }
+ assert_equal %w(thead tbody tfoot), table_section_names
end
test 'table with header and footer docbook' do
input = <<-EOS
.Table with header, body and footer
@@ -423,12 +513,25 @@
assert_css 'table > tgroup > tfoot > row > entry', output, 2
assert_css 'table > tgroup > tfoot > row > entry > simpara', output, 2
assert_css 'table > tgroup > tbody', output, 1
assert_css 'table > tgroup > tbody > row', output, 3
assert_css 'table > tgroup > tbody > row', output, 3
+ table_section_names = (xmlnodes_at_css 'table > tgroup > *', output).map(&:node_name).select {|n| n.start_with? 't' }
+ assert_equal %w(thead tbody tfoot), table_section_names
end
+ test 'should recognize ends as an alias to topbot for frame when converting to DocBook' do
+ input = <<-EOS
+[frame=ends]
+|===
+|A |B |C
+|===
+ EOS
+ output = render_embedded_string input, :backend => 'docbook'
+ assert_css 'informaltable[frame="topbot"]', output, 1
+ end
+
test 'table with landscape orientation in DocBook' do
['orientation=landscape', '%rotate'].each do |attrs|
input = <<-EOS
[#{attrs}]
|===
@@ -611,15 +714,15 @@
end
test 'styles not applied to header cells' do
input = <<-EOS
[cols="1h,1s,1e",options="header,footer"]
-|====
+|===
|Name |Occupation| Website
|Octocat |Social coding| https://github.com
|Name |Occupation| Website
-|====
+|===
EOS
output = render_embedded_string input
assert_css 'table', output, 1
assert_css 'table > thead > tr > th', output, 3
assert_css 'table > thead > tr > th > *', output, 0
@@ -637,19 +740,19 @@
end
test 'vertical table headers use th element instead of header class' do
input = <<-EOS
[cols="1h,1s,1e"]
-|====
+|===
|Name |Occupation| Website
|Octocat |Social coding| https://github.com
|Name |Occupation| Website
-|====
+|===
EOS
output = render_embedded_string input
assert_css 'table', output, 1
assert_css 'table > tbody > tr > th', output, 3
assert_css 'table > tbody > tr > td', output, 6
@@ -835,16 +938,16 @@
assert_xpath '(//row)[2]/entry[@nameend]', output, 0
end
test 'assigns unique column names for table with implicit column count and colspans in first row' do
input = <<-EOS
-|====
+|===
| 2+| Node 0 2+| Node 1
| Host processes | Core 0 | Core 1 | Core 4 | Core 5
| Guest processes | Core 2 | Core 3 | Core 6 | Core 7
-|====
+|===
EOS
output = render_embedded_string input, :backend => 'docbook'
assert_xpath '//colspec', output, 5
(1..5).each do |n|
@@ -857,23 +960,25 @@
assert_xpath '((//row)[1]/entry)[3][@namest="col_4"][@nameend="col_5"]', output, 1
end
test 'ignores cell with colspan that exceeds colspec' do
input = <<-EOS
-[cols="1,1"]
+[cols=2*]
|===
3+|A
|B
a|C
more C
|===
EOS
- output, warnings = redirect_streams {|_, err| [(render_embedded_string input), err.string] }
- assert_css 'table', output, 1
- assert_css 'table *', output, 0
- assert_includes warnings, 'exceeds specified number of columns'
+ using_memory_logger do |logger|
+ output = render_embedded_string input
+ assert_css 'table', output, 1
+ assert_css 'table *', output, 0
+ assert_message logger, :ERROR, '<stdin>: line 5: dropping cell because it exceeds specified number of columns', Hash
+ end
end
test 'paragraph, verse and literal content' do
input = <<-EOS
[cols=",^v,^l",options="header"]
@@ -941,11 +1046,11 @@
assert_xpath %((//p[@class="tableblock"])[1][text()="first wrapped\nparagraph"]), result, 1
assert_xpath %((//p[@class="tableblock"])[2][text()="second paragraph"]), result, 1
assert_xpath %((//p[@class="tableblock"])[3][text()="third paragraph"]), result, 1
end
- test 'basic asciidoc cell' do
+ test 'basic AsciiDoc cell' do
input = <<-EOS
|===
a|--
NOTE: content
@@ -960,13 +1065,25 @@
assert_css 'table.tableblock td.tableblock .openblock', result, 1
assert_css 'table.tableblock td.tableblock .openblock .admonitionblock', result, 1
assert_css 'table.tableblock td.tableblock .openblock .paragraph', result, 1
end
- test 'doctype can be set in asciidoc table cell' do
+ test 'AsciiDoc table cell should be wrapped in div with class "content"' do
input = <<-EOS
|===
+a|AsciiDoc table cell
+|===
+ EOS
+
+ result = render_embedded_string input
+ assert_css 'table.tableblock td.tableblock > div.content', result, 1
+ assert_css 'table.tableblock td.tableblock > div.content > div.paragraph', result, 1
+ end
+
+ test 'doctype can be set in AsciiDoc table cell' do
+ input = <<-EOS
+|===
a|
:doctype: inline
content
|===
@@ -1022,22 +1139,24 @@
assert_includes result, 'doctype=book'
refute_includes result, '{backend-html5-doctype-book}'
assert_includes result, '{backend-html5-doctype-article}'
end
- test 'asciidoc content' do
+ test 'AsciiDoc content' do
input = <<-EOS
[cols="1e,1,5a",frame="topbot",options="header"]
|===
|Name |Backends |Description
|badges |xhtml11, html5 |
Link badges ('XHTML 1.1' and 'CSS') in document footers.
-NOTE: The path names of images, icons and scripts are relative path
+[NOTE]
+====
+The path names of images, icons and scripts are relative path
names to the output document not the source document.
-
+====
|[[X97]] docinfo, docinfo1, docinfo2 |All backends |
These three attributes control which document information
files will be included in the the header of the output file:
docinfo:: Include `<filename>-docinfo.<ext>`
@@ -1048,35 +1167,64 @@
input file and `<ext>` is `.html` for HTML outputs or `.xml` for
DocBook outputs. If the input file is the standard input then the
output file name is used.
|===
EOS
- doc = document_from_string input
+ doc = document_from_string input, :sourcemap => true
table = doc.blocks.first
refute_nil table
tbody = table.rows.body
assert_equal 2, tbody.size
+ body_cell_1_2 = tbody[0][1]
+ assert_equal 5, body_cell_1_2.lineno
body_cell_1_3 = tbody[0][2]
refute_nil body_cell_1_3.inner_document
assert body_cell_1_3.inner_document.nested?
assert_equal doc, body_cell_1_3.inner_document.parent_document
assert_equal doc.converter, body_cell_1_3.inner_document.converter
- output = doc.render
+ assert_equal 5, body_cell_1_3.lineno
+ assert_equal 6, body_cell_1_3.inner_document.lineno
+ note = (body_cell_1_3.inner_document.find_by :context => :admonition)[0]
+ assert_equal 9, note.lineno
+ output = doc.convert :header_footer => false
assert_css 'table > tbody > tr', output, 2
assert_css 'table > tbody > tr:nth-child(1) > td:nth-child(3) div.admonitionblock', output, 1
assert_css 'table > tbody > tr:nth-child(2) > td:nth-child(3) div.dlist', output, 1
end
+ test 'should preserve leading indentation in contents of AsciiDoc table cell if contents starts with newline' do
+ input = <<-EOS
+|===
+a|
+ $ command
+a| paragraph
+|===
+ EOS
+ doc = document_from_string input, :sourcemap => true
+ table = doc.blocks[0]
+ tbody = table.rows.body
+ assert_equal 1, table.lineno
+ assert_equal 2, tbody[0][0].lineno
+ assert_equal 3, tbody[0][0].inner_document.lineno
+ assert_equal 4, tbody[1][0].lineno
+ output = doc.convert :header_footer => false
+ assert_css 'td', output, 2
+ assert_xpath '(//td)[1]//*[@class="literalblock"]', output, 1
+ assert_xpath '(//td)[2]//*[@class="paragraph"]', output, 1
+ assert_xpath '(//pre)[1][text()="$ command"]', output, 1
+ assert_xpath '(//p)[1][text()="paragraph"]', output, 1
+ end
+
test 'preprocessor directive on first line of an AsciiDoc table cell should be processed' do
input = <<-EOS
|===
a|include::fixtures/include-file.asciidoc[]
|===
EOS
- output = render_embedded_string input, :safe => :safe, :base_dir => File.dirname(__FILE__)
+ output = render_embedded_string input, :safe => :safe, :base_dir => testdir
assert_match(/included content/, output)
end
test 'cross reference link in an AsciiDoc table cell should resolve to reference in main document' do
input = <<-EOS
@@ -1094,46 +1242,71 @@
result = render_string input
assert_xpath '//a[@href="#_more"]', result, 1
assert_xpath '//a[@href="#_more"][text()="More"]', result, 1
end
+ test 'should discover anchor at start of cell 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.
+
+[cols="1s,1"]
+|===
+|[[mount-evans,Mount Evans]]Mount Evans
+|14,271 feet
+
+h|[[grays-peak,Grays Peak]]
+Grays Peak
+|14,278 feet
+|===
+ EOS
+ doc = document_from_string input
+ refs = doc.catalog[:refs]
+ assert refs.key?('mount-evans')
+ assert refs.key?('grays-peak')
+ output = doc.convert :header_footer => false
+ 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
+ assert_xpath '(//table/tbody/tr)[1]//td//a[@id="mount-evans"]', output, 1
+ assert_xpath '(//table/tbody/tr)[2]//th//a[@id="grays-peak"]', output, 1
+ end
+
test 'footnotes should not be shared between an AsciiDoc table cell and the main document' do
input = <<-EOS
|===
a|AsciiDoc footnote:[A lightweight markup language.]
|===
EOS
result = render_string input
- assert_css '#_footnote_1', result, 1
+ assert_css '#_footnotedef_1', result, 1
end
test 'callout numbers should be globally unique, including AsciiDoc table cells' do
input = <<-EOS
= Document Title
== Section 1
-|====
+|===
a|
[source, yaml]
----
key: value <1>
----
<1> First callout
-|====
+|===
== Section 2
-|====
+|===
a|
[source, yaml]
----
key: value <1>
----
<1> Second callout
-|====
+|===
== Section 3
[source, yaml]
----
@@ -1357,10 +1530,54 @@
assert_xpath '(/table/thead/tr/th)[1][@style="background-color: green;"]', output, 1
assert_xpath '(/table/thead/tr/th)[2][@style="background-color: green;"]', output, 0
assert_xpath '(/table/tbody/tr/td)[1][@style="background-color: red;"]', output, 1
assert_xpath '(/table/tbody/tr/td)[2][@style="background-color: green;"]', output, 0
end
+
+ test 'should warn if table block is not terminated' do
+ input = <<-EOS
+outside
+
+|===
+|
+inside
+
+still inside
+
+eof
+ EOS
+
+ using_memory_logger do |logger|
+ output = render_embedded_string input
+ assert_xpath '/table', output, 1
+ assert_message logger, :WARN, '<stdin>: line 3: unterminated table block', Hash
+ end
+ end
+
+ test 'should show correct line number in warning about unterminated block inside AsciiDoc table cell' do
+ input = <<-EOS
+outside
+
+* list item
++
+|===
+|cell
+a|inside
+
+====
+unterminated example block
+|===
+
+eof
+ EOS
+
+ using_memory_logger do |logger|
+ output = render_embedded_string input
+ assert_xpath '//ul//table', output, 1
+ assert_message logger, :WARN, '<stdin>: line 9: unterminated example block', Hash
+ end
+ end
end
context 'DSV' do
test 'renders simple dsv table' do
@@ -1413,15 +1630,15 @@
assert_css 'table td', output, 1
end
test 'should treat trailing colon as an empty cell' do
input = <<-EOS
-:====
+:===
A1:
B1:B2
C1:C2
-:====
+:===
EOS
output = render_embedded_string input
assert_css 'table', output, 1
assert_css 'table > colgroup > col', output, 2
assert_css 'table > tbody > tr', output, 3
@@ -1434,15 +1651,15 @@
context 'CSV' do
test 'should treat trailing comma as an empty cell' do
input = <<-EOS
-,====
+,===
A1,
B1,B2
C1,C2
-,====
+,===
EOS
output = render_embedded_string input
assert_css 'table', output, 1
assert_css 'table > colgroup > col', output, 2
assert_css 'table > tbody > tr', output, 3
@@ -1450,10 +1667,40 @@
assert_xpath '/table/tbody/tr[1]/td[1]/p[text()="A1"]', output, 1
assert_xpath '/table/tbody/tr[1]/td[2]/p', output, 0
assert_xpath '/table/tbody/tr[2]/td[1]/p[text()="B1"]', output, 1
end
+ test 'should preserve newlines in quoted CSV values' do
+ input = <<-EOS
+[cols="1,1,1l"]
+,===
+"A
+B
+C","one
+
+two
+
+three","do
+
+re
+
+me"
+,===
+ EOS
+ output = render_embedded_string input
+ assert_css 'table', output, 1
+ assert_css 'table > colgroup > col', output, 3
+ assert_css 'table > tbody > tr', output, 1
+ assert_xpath '/table/tbody/tr[1]/td', output, 3
+ assert_xpath %(/table/tbody/tr[1]/td[1]/p[text()="A\nB\nC"]), output, 1
+ assert_xpath '/table/tbody/tr[1]/td[2]/p', output, 3
+ assert_xpath '/table/tbody/tr[1]/td[2]/p[1][text()="one"]', output, 1
+ assert_xpath '/table/tbody/tr[1]/td[2]/p[2][text()="two"]', output, 1
+ assert_xpath '/table/tbody/tr[1]/td[2]/p[3][text()="three"]', output, 1
+ assert_xpath %(/table/tbody/tr[1]/td[3]//pre[text()="do\n\nre\n\nme"]), output, 1
+ end
+
test 'mixed unquoted records and quoted records with escaped quotes, commas, and wrapped lines' do
input = <<-EOS
[format="csv",options="header"]
|===
Year,Make,Model,Description,Price
@@ -1471,15 +1718,35 @@
assert_css 'table > colgroup > col[style*="width: 20%"]', output, 5
assert_css 'table > thead > tr', output, 1
assert_css 'table > tbody > tr', output, 6
assert_xpath '((//tbody/tr)[1]/td)[4]/p[text()="ac, abs, moon"]', output, 1
assert_xpath %(((//tbody/tr)[2]/td)[3]/p[text()='Venture "Extended Edition"']), output, 1
- assert_xpath '((//tbody/tr)[4]/td)[4]/p[text()="MUST SELL! air, moon roof, loaded"]', output, 1
+ assert_xpath %(((//tbody/tr)[4]/td)[4]/p[text()="MUST SELL!\nair, moon roof, loaded"]), output, 1
assert_xpath %(((//tbody/tr)[5]/td)[4]/p[text()='"This one#{decode_char 8217}s gonna to blow you#{decode_char 8217}re socks off," per the sticker']), output, 1
assert_xpath %(((//tbody/tr)[6]/td)[4]/p[text()='Check it, "this one#{decode_char 8217}s gonna to blow you#{decode_char 8217}re socks off", per the sticker']), output, 1
end
+ test 'should allow quotes around a CSV value to be on their own lines' do
+ input = <<-EOS
+[cols=2*]
+,===
+"
+A
+","
+B
+"
+,===
+ EOS
+ output = render_embedded_string input
+ assert_css 'table', output, 1
+ assert_css 'table > colgroup > col', output, 2
+ assert_css 'table > tbody > tr', output, 1
+ assert_xpath '/table/tbody/tr[1]/td', output, 2
+ assert_xpath '/table/tbody/tr[1]/td[1]/p[text()="A"]', output, 1
+ assert_xpath '/table/tbody/tr[1]/td[2]/p[text()="B"]', output, 1
+ end
+
test 'csv format shorthand' do
input = <<-EOS
,===
a,b,c
1,2,3
@@ -1580,11 +1847,11 @@
|Item |Quantity
|Item 1 |1
|===
EOS
output = render_embedded_string input, :backend => 'docbook45'
- assert output.include?('<?dbfo keep-together="auto"?>')
+ assert_includes output, '<?dbfo keep-together="auto"?>'
end
test 'table with breakable db5' do
input = <<-EOS
.Table with breakable
@@ -1593,11 +1860,11 @@
|Item |Quantity
|Item 1 |1
|===
EOS
output = render_embedded_string input, :backend => 'docbook5'
- assert output.include?('<?dbfo keep-together="auto"?>')
+ assert_includes output, '<?dbfo keep-together="auto"?>'
end
test 'table with unbreakable db5' do
input = <<-EOS
.Table with unbreakable
@@ -1606,11 +1873,11 @@
|Item |Quantity
|Item 1 |1
|===
EOS
output = render_embedded_string input, :backend => 'docbook5'
- assert output.include?('<?dbfo keep-together="always"?>')
+ assert_includes output, '<?dbfo keep-together="always"?>'
end
test 'table with unbreakable db45' do
input = <<-EOS
.Table with unbreakable
@@ -1619,16 +1886,16 @@
|Item |Quantity
|Item 1 |1
|===
EOS
output = render_embedded_string input, :backend => 'docbook45'
- assert output.include?('<?dbfo keep-together="always"?>')
+ assert_includes output, '<?dbfo keep-together="always"?>'
end
test 'no implicit header row if cell in first line is quoted and spans multiple lines' do
input = <<-EOS
-[cols=2*]
+[cols=2*l]
,===
"A1
A1 continued",B1
A2,B2
@@ -1638,9 +1905,9 @@
assert_css 'table', output, 1
assert_css 'table > colgroup > col', output, 2
assert_css 'table > thead', output, 0
assert_css 'table > tbody', output, 1
assert_css 'table > tbody > tr', output, 2
- assert_xpath '(//td)[1]/p[text()="A1 A1 continued"]', output, 1
+ assert_xpath %((//td)[1]//pre[text()="A1\n\nA1 continued"]), output, 1
end
end
end