From d11f8d551640c94e22c221c3bee39ab572b1dc72 Mon Sep 17 00:00:00 2001 From: Thomas Fuchs Date: Sun, 26 Feb 2006 14:20:21 +0000 Subject: Added script.aculo.us drag and drop helpers to RJS [Thomas Fuchs] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3667 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/template/prototype_helper_test.rb | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'actionpack/test/template/prototype_helper_test.rb') diff --git a/actionpack/test/template/prototype_helper_test.rb b/actionpack/test/template/prototype_helper_test.rb index 326363dc58..5a4ec61b39 100644 --- a/actionpack/test/template/prototype_helper_test.rb +++ b/actionpack/test/template/prototype_helper_test.rb @@ -3,6 +3,7 @@ require File.dirname(__FILE__) + '/../abstract_unit' module BaseTest include ActionView::Helpers::JavaScriptHelper include ActionView::Helpers::PrototypeHelper + include ActionView::Helpers::ScriptaculousHelper include ActionView::Helpers::UrlHelper include ActionView::Helpers::TagHelper @@ -255,4 +256,29 @@ Element.update("baz", "

This is a test

"); @generator.select('p.welcome b').first.hide assert_equal %($$('p.welcome b').first().hide();), @generator.to_s end + + def test_visual_effect + assert_equal %(new Effect.Puff('blah',{});), + @generator.visual_effect(:puff,'blah') + end + + def test_visual_effect_toggle + assert_equal %(Effect.toggle('blah','appear',{});), + @generator.visual_effect(:toggle_appear,'blah') + end + + def test_sortable + assert_equal %(Sortable.create('blah', {onUpdate:function(){new Ajax.Request('http://www.example.com/order', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize('blah')})}});), + @generator.sortable('blah', :url => { :action => "order" }) + end + + def test_draggable + assert_equal %(new Draggable('blah', {});), + @generator.draggable('blah') + end + + def test_drop_receiving + assert_equal %(Droppables.add('blah', {onDrop:function(element){new Ajax.Request('http://www.example.com/order', {asynchronous:true, evalScripts:true, parameters:'id=' + encodeURIComponent(element.id)})}});), + @generator.drop_receiving('blah', :url => { :action => "order" }) + end end \ No newline at end of file -- cgit v1.2.3