test/html/test_pretty.rb in temple-0.1.6 vs test/html/test_pretty.rb in temple-0.1.7
- old
+ new
@@ -5,36 +5,42 @@
@html = Temple::HTML::Pretty.new
end
it 'should indent nested tags' do
@html.compile([:html, :tag, 'div', [:multi], false,
- [:html, :tag, 'p', [:multi], false, [:static, 'text']]
+ [:html, :tag, 'p', [:multi], false, [:multi, [:static, 'text'], [:dynamic, 'code']]]
]).should.equal [:multi,
- [:static, "<div"],
- [:multi],
- [:static, ">"],
+ [:block, "_temple_pre_tags = /<pre|<textarea/"],
[:multi,
- [:static, "\n <p"],
+ [:static, "<div"],
[:multi],
[:static, ">"],
- [:static, "text"],
- [:static, "</p>"]],
- [:static, "\n</div>"]]
+ [:multi,
+ [:static, "\n <p"],
+ [:multi],
+ [:static, ">"],
+ [:multi,
+ [:static, "text"],
+ [:dynamic, 'Temple::Utils.indent((code), "\n ", _temple_pre_tags)']],
+ [:static, "</p>"]],
+ [:static, "\n</div>"]]]
end
it 'should not indent preformatted tags' do
@html.compile([:html, :tag, 'pre', [:multi], false,
[:html, :tag, 'p', [:multi], false, [:static, 'text']]
]).should.equal [:multi,
- [:static, "<pre"],
- [:multi],
- [:static, ">"],
+ [:block, "_temple_pre_tags = /<pre|<textarea/"],
[:multi,
- [:static, "<p"],
+ [:static, "<pre"],
[:multi],
[:static, ">"],
- [:static, "text"],
- [:static, "</p>"]],
- [:static, "</pre>"]]
+ [:multi,
+ [:static, "<p"],
+ [:multi],
+ [:static, ">"],
+ [:static, "text"],
+ [:static, "</p>"]],
+ [:static, "</pre>"]]]
end
end