test/tables_test.rb in asciidoctor-0.0.9 vs test/tables_test.rb in asciidoctor-0.1.0

- old
+ new

@@ -37,11 +37,11 @@ |a |b |c |1 |2 |3 |======= EOS output = render_embedded_string input - assert_xpath '/table/caption[@class="title"][text()="Simple psv table"]', output, 1 + assert_xpath '/table/caption[@class="title"][text()="Table 1. Simple psv table"]', output, 1 assert_xpath '/table/caption/following-sibling::colgroup', output, 1 end test 'ignores escaped separators' do input = <<-EOS @@ -56,10 +56,27 @@ assert_css 'table > tbody > tr > td', output, 2 assert_xpath '/table/tbody/tr/td[1]/p[text()="A | here"]', output, 1 assert_xpath '/table/tbody/tr/td[2]/p[text()="a | there"]', output, 1 end + test 'should auto recover with warning if missing leading separator on first cell' do + input = <<-EOS +|=== +A | here| a | there +|=== + EOS + output = render_embedded_string input + 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 + end + test 'performs normal substitutions on cell content' do input = <<-EOS :show_title: Cool new show |=== |{show_title} |Coming soon... @@ -215,11 +232,11 @@ |=== EOS output = render_embedded_string input assert_css 'table', output, 1 assert_css 'table[style~="width: 80%;"]', output, 1 - assert_xpath '/table/caption[@class="title"][text()="Horizontal and vertical source data"]', output, 1 + assert_xpath '/table/caption[@class="title"][text()="Table 1. Horizontal and vertical source data"]', output, 1 assert_css 'table > colgroup > col', output, 4 assert_css 'table > colgroup > col:nth-child(1)[@style~="width: 17%;"]', output, 1 assert_css 'table > colgroup > col:nth-child(2)[@style~="width: 11%;"]', output, 1 assert_css 'table > colgroup > col:nth-child(3)[@style~="width: 11%;"]', output, 1 assert_css 'table > colgroup > col:nth-child(4)[@style~="width: 58%;"]', output, 1 @@ -240,11 +257,11 @@ [cols="e,m,^,>s",width="25%"] |=== |1 >s|2 |3 |4 ^|5 2.2+^.^|6 .3+<.>m|7 ^|8 -|9 2+>|10 +d|9 2+>|10 |=== EOS output = render_embedded_string input assert_css 'table', output, 1 assert_css 'table > colgroup > col[style~="width: 25%;"]', output, 4 @@ -265,10 +282,11 @@ assert_css 'table tr:nth-child(2) > td:nth-child(2).halign-center.valign-middle[colspan="2"][rowspan="2"] p tt', output, 1 assert_css 'table tr:nth-child(2) > td:nth-child(3).halign-left.valign-bottom[rowspan="3"] p tt', output, 1 assert_css 'table tr:nth-child(3) > td:nth-child(1).halign-center.valign-top p em', output, 1 - assert_css 'table tr:nth-child(4) > td:nth-child(1).halign-left.valign-top p em', output, 1 + assert_css 'table tr:nth-child(4) > td:nth-child(1).halign-left.valign-top p', output, 1 + assert_css 'table tr:nth-child(4) > td:nth-child(1).halign-left.valign-top p em', output, 0 assert_css 'table tr:nth-child(4) > td:nth-child(2).halign-right.valign-top[colspan="2"] p tt', output, 1 end test 'supports repeating cells' do input = <<-EOS