mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Add a template test for partial layout rendering.
This commit is contained in:
parent
998578aed6
commit
e4e1ba2828
4 changed files with 20 additions and 1 deletions
5
test/haml/results/partial_layout.xhtml
Normal file
5
test/haml/results/partial_layout.xhtml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<h1>Partial layout used with for block:</h1>
|
||||
<div class='partial-layout'>
|
||||
<h2>This is inside a partial layout</h2>
|
||||
<p>Some content within a layout</p>
|
||||
</div>
|
|
@ -18,11 +18,17 @@ module Haml::Helpers
|
|||
end
|
||||
end
|
||||
|
||||
class DummyController
|
||||
def self.controller_path
|
||||
''
|
||||
end
|
||||
end
|
||||
|
||||
class TemplateTest < Test::Unit::TestCase
|
||||
TEMPLATE_PATH = File.join(File.dirname(__FILE__), "templates")
|
||||
TEMPLATES = %w{ very_basic standard helpers
|
||||
whitespace_handling original_engine list helpful
|
||||
silent_script tag_parsing just_stuff partials
|
||||
silent_script tag_parsing just_stuff partials partial_layout
|
||||
filters nuke_outer_whitespace nuke_inner_whitespace }
|
||||
|
||||
def setup
|
||||
|
@ -49,6 +55,8 @@ class TemplateTest < Test::Unit::TestCase
|
|||
|
||||
# filters template uses :sass
|
||||
Sass::Plugin.options.update(:line_comments => true, :style => :compact)
|
||||
|
||||
@base.controller = DummyController.new
|
||||
end
|
||||
|
||||
def render(text)
|
||||
|
|
3
test/haml/templates/_layout_for_partial.haml
Normal file
3
test/haml/templates/_layout_for_partial.haml
Normal file
|
@ -0,0 +1,3 @@
|
|||
.partial-layout
|
||||
%h2 This is inside a partial layout
|
||||
= yield
|
3
test/haml/templates/partial_layout.haml
Normal file
3
test/haml/templates/partial_layout.haml
Normal file
|
@ -0,0 +1,3 @@
|
|||
%h1 Partial layout used with for block:
|
||||
- render :layout => 'layout_for_partial.haml' do
|
||||
%p Some content within a layout
|
Loading…
Add table
Reference in a new issue