Sha256: 160ebb1c15e7a0f95a3dd5eeef892d0559d6e64bf24ff3c622bec6999fcd1e31

Contents?: true

Size: 840 Bytes

Versions: 4

Compression:

Stored size: 840 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}\np 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

4 entries across 4 versions & 1 rubygems

Version Path
hamlet-0.4.2 test/slim/test_chain_manipulation.rb
hamlet-0.4.1 test/slim/test_chain_manipulation.rb
hamlet-0.4.0 test/slim/test_chain_manipulation.rb
hamlet-0.3.0 test/slim/test_chain_manipulation.rb