Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add a template test with partial layout rendering

  • Loading branch information...
commit bdfe0fc4cf5cdeb0a8688159486e15cd225ab5ea 1 parent bcc94e6
@mislav authored
View
5 test/haml/results/partial_layout.xhtml
@@ -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>
View
10 test/haml/template_test.rb
@@ -18,11 +18,17 @@ def test_partial(name, locals = {})
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 @@ def @base.protect_against_forgery?; false; end
# filters template uses :sass
Sass::Plugin.options.update(:line_comments => true, :style => :compact)
+
+ @base.controller = DummyController.new
end
def render(text)
View
3  test/haml/templates/_layout_for_partial.haml
@@ -0,0 +1,3 @@
+.partial-layout
+ %h2 This is inside a partial layout
+ = yield
View
3  test/haml/templates/partial_layout.haml
@@ -0,0 +1,3 @@
+%h1 Partial layout used with for block:
+- render :layout => 'layout_for_partial.haml' do
+ %p Some content within a layout
Please sign in to comment.
Something went wrong with that request. Please try again.