Sha256: 4b9312722a18ccd2840df018a88f21e53b69cac4e72d3612ab6047321913fd09

Contents?: true

Size: 836 Bytes

Versions: 12

Compression:

Stored size: 836 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(Slim::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(Slim::Parser, :ReplaceParsedExp) do |exp|
        [:slim, :output, false, '1+1', [:multi]]
      end
    end

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

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
slim-1.1.0 test/slim/test_chain_manipulation.rb
slim-1.0.4 test/slim/test_chain_manipulation.rb
hamlet-0.2.1 test/slim/test_chain_manipulation.rb
hamlet-0.2 test/slim/test_chain_manipulation.rb
hamlet-0.1 test/slim/test_chain_manipulation.rb
slim-1.0.3 test/slim/test_chain_manipulation.rb
slim-1.0.2 test/slim/test_chain_manipulation.rb
slim-1.0.1 test/slim/test_chain_manipulation.rb
slim-1.0.0 test/slim/test_chain_manipulation.rb
slim-0.9.4 test/slim/test_chain_manipulation.rb
slim-0.9.3 test/slim/test_chain_manipulation.rb
slim-0.9.2 test/slim/test_chain_manipulation.rb