diff options
author | Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com> | 2009-06-17 12:00:23 -0700 |
---|---|---|
committer | Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com> | 2009-06-17 12:54:19 -0700 |
commit | 4fad953f90f82e860a69d67745887b40d5b15475 (patch) | |
tree | f66c81f08091549160ce064dce257017f5567282 /actionpack/test/new_base | |
parent | de388ba864ab47cbb3d92b3a36af254540788ed5 (diff) | |
download | rails-4fad953f90f82e860a69d67745887b40d5b15475.tar.gz rails-4fad953f90f82e860a69d67745887b40d5b15475.tar.bz2 rails-4fad953f90f82e860a69d67745887b40d5b15475.zip |
Fixing pending tests and fixed some formats / partial rendering semantics
Diffstat (limited to 'actionpack/test/new_base')
-rw-r--r-- | actionpack/test/new_base/render_rjs_test.rb | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/actionpack/test/new_base/render_rjs_test.rb b/actionpack/test/new_base/render_rjs_test.rb new file mode 100644 index 0000000000..fdf3556e8e --- /dev/null +++ b/actionpack/test/new_base/render_rjs_test.rb @@ -0,0 +1,46 @@ +require File.join(File.expand_path(File.dirname(__FILE__)), "test_helper") + +module RenderRjs + + class BasicController < ActionController::Base + + self.view_paths = [ActionView::Template::FixturePath.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/_customer.js.erb" => "JS Partial", + "render_rjs/basic/_customer.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" + )] + + def index + render + end + + def index_locale + old_locale, I18n.locale = I18n.locale, :da + end + + end + + class TestBasic < SimpleRouteCase + testing BasicController + + test "rendering a partial in an RJS template should pick the JS template over the HTML one" do + get :index + assert_response("$(\"customer\").update(\"JS 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 + assert_response("$(\"customer\").update(\"HTML Partial\");") + end + + test "replacing an element with a partial in an RJS template with a locale should pick the localed HTML template" do + get :index_locale, :format => :js + assert_response("$(\"customer\").update(\"Danish HTML Partial\");") + end + + end +end
\ No newline at end of file |