require 'helper' describe Temple::HTML::Pretty do before do @html = Temple::HTML::Pretty.new end it 'should indent nested tags' do @html.call([:html, :tag, 'div', [:multi], [:html, :tag, 'p', [:multi], [:multi, [:static, 'text'], [:dynamic, 'code']]] ]).should.equal [:multi, [:code, "_temple_html_pretty1 = /"], [:multi, [:static, "\n "], [:multi, [:static, "\n text"], [:dynamic, "::Temple::Utils.indent_dynamic((code), false, \"\\n \", _temple_html_pretty1)"]], [:static, "\n

"]], [:static, "\n"]]] end it 'should not indent preformatted tags' do @html.call([:html, :tag, 'pre', [:multi], [:html, :tag, 'p', [:multi], [:static, 'text']] ]).should.equal [:multi, [:code, "_temple_html_pretty1 = /"], [:multi, [:static, ""], [:static, "text"], [:static, "

"]], [:static, ""]]] end it 'should not escape html_safe strings' do with_html_safe do @html.call( [:dynamic, '"text<".html_safe'] ).should.equal [:multi, [:code, "_temple_html_pretty1 = /