From b35562f432d0807517a614a540026c2fc557e2ac Mon Sep 17 00:00:00 2001 From: Matt Jones Date: Tue, 24 Feb 2009 10:38:07 -0600 Subject: correctly handle layouts for AJAX requests and regular js files [#2052 state:resolved] Signed-off-by: Joshua Peek --- actionpack/test/controller/render_test.rb | 9 +++++---- actionpack/test/fixtures/layouts/xhr.html.erb | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 actionpack/test/fixtures/layouts/xhr.html.erb (limited to 'actionpack/test') diff --git a/actionpack/test/controller/render_test.rb b/actionpack/test/controller/render_test.rb index e131a735a9..70e5e62c93 100644 --- a/actionpack/test/controller/render_test.rb +++ b/actionpack/test/controller/render_test.rb @@ -684,12 +684,13 @@ class TestController < ActionController::Base "render_with_explicit_string_template", "render_js_with_explicit_template", "render_js_with_explicit_action_template", - "delete_with_js", "update_page", "update_page_with_instance_variables", - "render_implicit_js_template_without_layout" + "delete_with_js", "update_page", "update_page_with_instance_variables" "layouts/standard" when "action_talk_to_layout", "layout_overriding_layout" "layouts/talk_from_action" + when "render_implicit_html_template_from_xhr_request" + (request.xhr? ? 'layouts/xhr' : 'layouts/standard') end end end @@ -1018,8 +1019,8 @@ class RenderTest < ActionController::TestCase end def test_should_implicitly_render_html_template_from_xhr_request - get :render_implicit_html_template_from_xhr_request, :format => :js - assert_equal "Hello HTML!", @response.body + xhr :get, :render_implicit_html_template_from_xhr_request + assert_equal "XHR!\nHello HTML!", @response.body end def test_should_implicitly_render_js_template_without_layout diff --git a/actionpack/test/fixtures/layouts/xhr.html.erb b/actionpack/test/fixtures/layouts/xhr.html.erb new file mode 100644 index 0000000000..85285324ec --- /dev/null +++ b/actionpack/test/fixtures/layouts/xhr.html.erb @@ -0,0 +1,2 @@ +XHR! +<%= yield %> \ No newline at end of file -- cgit v1.2.3