summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2019-08-20 01:08:42 -0600
committerDan Allen <dan.j.allen@gmail.com>2019-08-20 01:08:42 -0600
commit312464f1ec20f1b1966f05b95a4478f695942a71 (patch)
tree79a5241c03469d13eebf1edd7c2a8a7f103bbe76 /spec
parentc89079c488dcd6daecdf22a88970bda450a23ba0 (diff)
fix test to verify newlines and whitespace are normalized in paragraph and normal table cell
Diffstat (limited to 'spec')
-rw-r--r--spec/paragraph_spec.rb7
-rw-r--r--spec/table_spec.rb19
2 files changed, 21 insertions, 5 deletions
diff --git a/spec/paragraph_spec.rb b/spec/paragraph_spec.rb
index 3250fa6b..f2a3f4a8 100644
--- a/spec/paragraph_spec.rb
+++ b/spec/paragraph_spec.rb
@@ -1,17 +1,18 @@
require_relative 'spec_helper'
describe 'Asciidoctor::PDF::Converter - Paragraph' do
- it 'should normalize whitespace' do
+ it 'should normalize newlines and whitespace' do
pdf = to_pdf <<~EOS, analyze: true
He's a real nowhere man,
Sitting in his nowhere land,
Making all his nowhere plans\tfor nobody.
EOS
- text = pdf.text
- (expect text).to have_size 1
+ (expect pdf.text).to have_size 1
+ text = pdf.text[0][:string]
(expect text).not_to include ' '
(expect text).not_to include ?\t
(expect text).not_to include ?\n
+ (expect text).to include 'man, Sitting'
end
it 'should indent first line of paragraph if prose_text_indent key is set in theme' do
diff --git a/spec/table_spec.rb b/spec/table_spec.rb
index e8da8244..05185643 100644
--- a/spec/table_spec.rb
+++ b/spec/table_spec.rb
@@ -329,8 +329,7 @@ describe 'Asciidoctor::PDF::Converter - Table' do
it 'should keep paragraphs in table cell separate' do
pdf = to_pdf <<~'EOS', analyze: true
|===
- |all one
- line
+ |all one line
|line 1 +
line 2
@@ -351,6 +350,22 @@ describe 'Asciidoctor::PDF::Converter - Table' do
(expect cell_3_text[0][:y]).to be > cell_3_text[1][:y]
(expect cell_3_text[0][:y] - cell_3_text[1][:y]).to be > (cell_2_text[0][:y] - cell_2_text[1][:y])
end
+
+ it 'should normalize newlines and whitespace' do
+ pdf = to_pdf <<~EOS, analyze: true
+ |===
+ |He's a real nowhere man,
+ Sitting in his nowhere land,
+ Making all his nowhere plans\tfor nobody.
+ |===
+ EOS
+ (expect pdf.text).to have_size 1
+ text = pdf.text[0][:string]
+ (expect text).not_to include ' '
+ (expect text).not_to include ?\t
+ (expect text).not_to include ?\n
+ (expect text).to include 'man, Sitting'
+ end
end
context 'AsciiDoc table cell' do