From ab211bf592f52fbde7853961030046ea1d387851 Mon Sep 17 00:00:00 2001 From: Sam Stephenson Date: Thu, 4 Dec 2008 16:35:13 -0600 Subject: Fix rendering html partials from an rjs template Signed-off-by: Joshua Peek --- actionpack/test/controller/render_test.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'actionpack/test/controller/render_test.rb') diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index 972e425e35..795ad97863 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -255,6 +255,12 @@ class TestController < ActionController::Base render :inline => "Hello world <%= helper_method_to_render_to_string :partial => 'test/partial_with_only_html_version' %>" end + def render_implicit_html_template + end + + def render_explicit_html_template + end + def formatted_html_erb end @@ -947,6 +953,24 @@ class RenderTest < ActionController::TestCase assert_equal "Hello world partial with only html version", @response.body end + def test_render_in_an_rjs_template_should_pick_html_templates_when_available + [:js, "js"].each do |format| + assert_nothing_raised do + get :render_implicit_html_template, :format => format + assert_equal %(document.write("Hello world\\n");), @response.body + end + end + end + + def test_explicitly_rendering_an_html_template_with_implicit_html_template_renders_should_be_possible_from_an_rjs_template + [:js, "js"].each do |format| + assert_nothing_raised do + get :render_explicit_html_template, :format => format + assert_equal %(document.write("Hello world\\n");), @response.body + end + end + end + def test_should_render_formatted_template get :formatted_html_erb assert_equal 'formatted html erb', @response.body -- cgit v1.2.3