Sha256: 6c0ce1f07a7a61d21ef796c90b5dca88e93347315681a293ec581a0d0e300d95

Contents?: true

Size: 845 Bytes

Versions: 2

Compression:

Stored size: 845 Bytes

Contents

require 'helper'

class TestSlimChainManipulation < TestSlim
  def test_replace
    source = %q{
p Test
}
    chain = proc do |engine|
      engine.replace(Temple::HTML::Pretty, :ReplacementFilter) do |exp|
        [:dynamic, '1+1']
      end
    end

    assert_html '2', source, :chain => chain
  end

  def test_before
    source = %q{
<p>Test
}
    chain = proc do |engine|
      engine.before(Hamlet::Parser, :WrapInput) do |input|
        "<p>Header\n#{input}\n<p>Footer"
      end
    end

    assert_html '<p>Header</p> <p>Test</p> <p>Footer</p>', source, :chain => chain
  end

  def test_after
    source = %q{
p Test
}
    chain = proc do |engine|
      engine.after(Hamlet::Parser, :ReplaceParsedExp) do |exp|
        [:slim, :output, false, '1+1', [:multi]]
      end
    end

    assert_html '2', source, :chain => chain
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hamlet-0.5.0.1 test/slim/test_chain_manipulation.rb
hamlet-0.5.0 test/slim/test_chain_manipulation.rb