diff options
author | Marcel Molina <marcel@vernix.org> | 2005-11-17 21:28:59 +0000 |
---|---|---|
committer | Marcel Molina <marcel@vernix.org> | 2005-11-17 21:28:59 +0000 |
commit | 06e74b6c91d48cd482ef7ee32817510dcd07f97a (patch) | |
tree | 6d93c120a7c396482c79144a56bd07a50c0e88b0 /actionpack/test | |
parent | fd66ccb01658b7cc7654e42233fd760b4fc788ff (diff) | |
download | rails-06e74b6c91d48cd482ef7ee32817510dcd07f97a.tar.gz rails-06e74b6c91d48cd482ef7ee32817510dcd07f97a.tar.bz2 rails-06e74b6c91d48cd482ef7ee32817510dcd07f97a.zip |
Add support for new rjs templates which wrap an update_page block.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3078 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/new_render_test.rb | 29 | ||||
-rw-r--r-- | actionpack/test/fixtures/test/delete_with_js.rjs | 2 |
2 files changed, 31 insertions, 0 deletions
diff --git a/actionpack/test/controller/new_render_test.rb b/actionpack/test/controller/new_render_test.rb index 919875e8c3..7cd17f1d55 100644 --- a/actionpack/test/controller/new_render_test.rb +++ b/actionpack/test/controller/new_render_test.rb @@ -154,6 +154,20 @@ class NewRenderTestController < ActionController::Base render :action => "potential_conflicts" end + def delete_with_js + @project_id = 4 + end + + def render_js_with_explicit_template + @project_id = 4 + render :template => 'test/delete_with_js' + end + + def render_js_with_explicit_action_template + @project_id = 4 + render :action => 'delete_with_js' + end + def action_talk_to_layout # Action template sets variable that's picked up by layout end @@ -279,6 +293,21 @@ class NewRenderTest < Test::Unit::TestCase assert_equal "<p>This is grand!</p>\n", @response.body end + def test_render_rjs_with_default + get :delete_with_js + assert_equal %!["person"].each(Element.remove);\nnew Effect.Highlight('project-4',{});!, @response.body + end + + def test_render_rjs_template_explicitly + get :render_js_with_explicit_template + assert_equal %!["person"].each(Element.remove);\nnew Effect.Highlight('project-4',{});!, @response.body + end + + def test_rendering_rjs_action_explicitly + get :render_js_with_explicit_action_template + assert_equal %!["person"].each(Element.remove);\nnew Effect.Highlight('project-4',{});!, @response.body + end + def test_layout_rendering get :layout_test assert_equal "<html>Hello world!</html>", @response.body diff --git a/actionpack/test/fixtures/test/delete_with_js.rjs b/actionpack/test/fixtures/test/delete_with_js.rjs new file mode 100644 index 0000000000..4b75a955ad --- /dev/null +++ b/actionpack/test/fixtures/test/delete_with_js.rjs @@ -0,0 +1,2 @@ +page.remove 'person' +page.visual_effect :highlight, "project-#{@project_id}" |