Sha256: 652b58b0ee237652ac3250f1dedf2b1ab58b858833ad2e04dd735a27bb84de8e

Contents?: true

Size: 1.59 KB

Versions: 2

Compression:

Stored size: 1.59 KB

Contents

require 'helper'

describe Temple::HTML::Pretty do
  before do
    @html = Temple::HTML::Pretty.new
  end

  it 'should indent nested tags' do
    @html.compile([:html, :tag, 'div', [:multi], false,
      [:html, :tag, 'p', [:multi], false, [:multi, [:static, 'text'], [:dynamic, 'code']]]
    ]).should.equal [:multi,
                     [:block, "_temple_pre_tags = /<pre|<textarea/"],
                     [:multi,
                      [:static, "<div"],
                      [:multi],
                      [:static, ">"],
                      [: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,
                     [:block, "_temple_pre_tags = /<pre|<textarea/"],
                     [:multi,
                      [:static, "<pre"],
                      [:multi],
                      [:static, ">"],
                      [:multi,
                       [:static, "<p"],
                       [:multi],
                       [:static, ">"],
                       [:static, "text"],
                       [:static, "</p>"]],
                      [:static, "</pre>"]]]
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
temple-0.1.8 test/html/test_pretty.rb
temple-0.1.7 test/html/test_pretty.rb