diff options
author | José Valim <jose.valim@gmail.com> | 2010-03-16 23:35:45 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-03-16 23:36:29 +0100 |
commit | 56fb60ebfe9a20ced1366f3e35b2f9bd0bac8e45 (patch) | |
tree | 3874a26e06ac0f4f4bee337b074c94f5d77356a2 /actionpack/test/controller | |
parent | df735cf5b712312a161d703f2606b145ea2d3b85 (diff) | |
download | rails-56fb60ebfe9a20ced1366f3e35b2f9bd0bac8e45.tar.gz rails-56fb60ebfe9a20ced1366f3e35b2f9bd0bac8e45.tar.bz2 rails-56fb60ebfe9a20ced1366f3e35b2f9bd0bac8e45.zip |
Fix rendering of HTML partials inside JS templates [#4197 status:resolved]
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/new_base/render_rjs_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/actionpack/test/controller/new_base/render_rjs_test.rb b/actionpack/test/controller/new_base/render_rjs_test.rb index f4516ade63..7c8f1cb869 100644 --- a/actionpack/test/controller/new_base/render_rjs_test.rb +++ b/actionpack/test/controller/new_base/render_rjs_test.rb @@ -5,8 +5,10 @@ module RenderRjs self.view_paths = [ActionView::FixtureResolver.new( "render_rjs/basic/index.js.rjs" => "page[:customer].replace_html render(:partial => 'customer')", "render_rjs/basic/index_html.js.rjs" => "page[:customer].replace_html :partial => 'customer'", + "render_rjs/basic/index_no_js.js.rjs" => "page[:developer].replace_html render(:partial => 'developer')", "render_rjs/basic/_customer.js.erb" => "JS Partial", "render_rjs/basic/_customer.html.erb" => "HTML Partial", + "render_rjs/basic/_developer.html.erb" => "HTML Partial", "render_rjs/basic/index_locale.js.rjs" => "page[:customer].replace_html :partial => 'customer'", "render_rjs/basic/_customer.da.html.erb" => "Danish HTML Partial", "render_rjs/basic/_customer.da.js.erb" => "Danish JS Partial" @@ -37,6 +39,11 @@ module RenderRjs assert_response("$(\"customer\").update(\"JS Partial\");") end + test "rendering a partial in an RJS template should pick the HTML one if no JS is available" do + get :index_no_js, "format" => "js" + assert_response("$(\"developer\").update(\"HTML Partial\");") + end + test "replacing an element with a partial in an RJS template should pick the HTML template over the JS one" do get :index_html, "format" => "js" assert_response("$(\"customer\").update(\"HTML Partial\");") |