summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2019-01-09 23:35:08 -0700
committerGitHub <noreply@github.com>2019-01-09 23:35:08 -0700
commit1641e885e4e101129c50d6ce851a7fcccccee079 (patch)
tree01446ca4b9e0e80071e24ca6b3f79ec5b81a3ac9 /test
parent7974f011093dfabbe846bd59ef8f65f7deacec0b (diff)
resolves #3006 fix deprecated ERB trim mode (PR #3007)
- use 0 instead of < - augment test to verify behavior of trim mode - remove encoding setting from ERB template
Diffstat (limited to 'test')
-rw-r--r--test/converter_test.rb14
-rw-r--r--test/fixtures/custom-backends/erb/html5/block_paragraph.html.erb2
-rw-r--r--test/fixtures/custom-backends/erb/html5/open.html.erb8
3 files changed, 22 insertions, 2 deletions
diff --git a/test/converter_test.rb b/test/converter_test.rb
index 53829434..0ceedf15 100644
--- a/test/converter_test.rb
+++ b/test/converter_test.rb
@@ -225,7 +225,8 @@ Sidebar content
end
test 'should load ERB templates using ERBTemplate if eruby is not set' do
- doc = Asciidoctor::Document.new [], template_dir: (fixture_path 'custom-backends/erb'), template_cache: false
+ input = %([.wrapper]\n--\nfoobar\n--)
+ doc = Asciidoctor::Document.new input, template_dir: (fixture_path 'custom-backends/erb'), template_cache: false
assert_kind_of Asciidoctor::Converter::CompositeConverter, doc.converter
['paragraph'].each do |node_name|
selected = doc.converter.find_converter node_name
@@ -236,6 +237,17 @@ Sidebar content
assert_kind_of ::ERB, template.instance_variable_get('@engine')
assert_equal %(block_#{node_name}.html.erb), File.basename(selected.templates[node_name].file)
end
+ # NOTE verify behavior of trim mode
+ expected_output = <<-EOS.chomp
+<div class="openblock wrapper">
+<div class="content">
+<div class="paragraph">
+<p>foobar</p>
+</div>
+</div>
+</div>
+ EOS
+ assert_equal expected_output, doc.convert
end
test 'should load ERB templates using ErubisTemplate if eruby is set to erubis' do
diff --git a/test/fixtures/custom-backends/erb/html5/block_paragraph.html.erb b/test/fixtures/custom-backends/erb/html5/block_paragraph.html.erb
index 7eb80950..eaaef93c 100644
--- a/test/fixtures/custom-backends/erb/html5/block_paragraph.html.erb
+++ b/test/fixtures/custom-backends/erb/html5/block_paragraph.html.erb
@@ -1,4 +1,4 @@
-<%#encoding:UTF-8%><div<%= @id && %( id="#{@id}") %> class="<%= ['paragraph',role].compact * ' ' %>"><%
+<div<%= @id && %( id="#{@id}") %> class="<%= ['paragraph',role].compact * ' ' %>"><%
if title? %>
<div class="title"><%= title %></div><%
end %>
diff --git a/test/fixtures/custom-backends/erb/html5/open.html.erb b/test/fixtures/custom-backends/erb/html5/open.html.erb
new file mode 100644
index 00000000..ca738ed7
--- /dev/null
+++ b/test/fixtures/custom-backends/erb/html5/open.html.erb
@@ -0,0 +1,8 @@
+<div<%= @id && %( id="#{@id}") %> class="<%= ['openblock',(@style == 'open' ? nil : @style),role].compact * ' ' %>"><%
+ if title? %>
+<div class="title"><%= title %></div><%
+ end %>
+<div class="content">
+<%= content %>
+</div>
+</div>