diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-05 06:42:58 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-03-05 06:42:58 +0000 |
commit | 16b9409a9c087d26e415de9fe66b8a754d76e7f0 (patch) | |
tree | e597e18fd2a5518ed717749077c216a748945787 /actionpack/test/template/scriptaculous_helper_test.rb | |
parent | 5afbffdd95c738f33f41efc0a42af1b73ad4dfe4 (diff) | |
download | rails-16b9409a9c087d26e415de9fe66b8a754d76e7f0.tar.gz rails-16b9409a9c087d26e415de9fe66b8a754d76e7f0.tar.bz2 rails-16b9409a9c087d26e415de9fe66b8a754d76e7f0.zip |
allow RJS enum values to be passed to visual_effect() and other scriptaculous helpers #4080 [Rick Olson]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3772 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/template/scriptaculous_helper_test.rb')
-rw-r--r-- | actionpack/test/template/scriptaculous_helper_test.rb | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/actionpack/test/template/scriptaculous_helper_test.rb b/actionpack/test/template/scriptaculous_helper_test.rb index 0a76f7d652..8ae45af50c 100644 --- a/actionpack/test/template/scriptaculous_helper_test.rb +++ b/actionpack/test/template/scriptaculous_helper_test.rb @@ -22,56 +22,56 @@ class ScriptaculousHelperTest < Test::Unit::TestCase end def test_effect - assert_equal "new Effect.Highlight('posts',{});", visual_effect(:highlight, "posts") - assert_equal "new Effect.Highlight('posts',{});", visual_effect("highlight", :posts) - assert_equal "new Effect.Highlight('posts',{});", visual_effect(:highlight, :posts) - assert_equal "new Effect.Fade('fademe',{duration:4.0});", visual_effect(:fade, "fademe", :duration => 4.0) + assert_equal "new Effect.Highlight(\"posts\",{});", visual_effect(:highlight, "posts") + assert_equal "new Effect.Highlight(\"posts\",{});", visual_effect("highlight", :posts) + assert_equal "new Effect.Highlight(\"posts\",{});", visual_effect(:highlight, :posts) + assert_equal "new Effect.Fade(\"fademe\",{duration:4.0});", visual_effect(:fade, "fademe", :duration => 4.0) assert_equal "new Effect.Shake(element,{});", visual_effect(:shake) - assert_equal "new Effect.DropOut('dropme',{queue:'end'});", visual_effect(:drop_out, 'dropme', :queue => :end) - assert_equal "new Effect.DropOut('dropme',{queue:{limit:2,scope:'test',position:'end'}});", + assert_equal "new Effect.DropOut(\"dropme\",{queue:'end'});", visual_effect(:drop_out, 'dropme', :queue => :end) + assert_equal "new Effect.DropOut(\"dropme\",{queue:{limit:2,scope:'test',position:'end'}});", visual_effect(:drop_out, 'dropme', :queue => {:position => "end", :scope => "test", :limit => 2}) - assert_equal "new Effect.DropOut('dropme',{queue:{limit:2,scope:'list'}});", + assert_equal "new Effect.DropOut(\"dropme\",{queue:{limit:2,scope:'list'}});", visual_effect(:drop_out, 'dropme', :queue => {:scope => :list, :limit => 2}) - assert_equal "new Effect.DropOut('dropme',{queue:{limit:2,scope:'test',position:'end'}});", + assert_equal "new Effect.DropOut(\"dropme\",{queue:{limit:2,scope:'test',position:'end'}});", visual_effect(:drop_out, 'dropme', :queue => {:position => :end, :scope => :test, :limit => 2}) end def test_toggle_effects - assert_equal "Effect.toggle('posts','appear',{});", visual_effect(:toggle_appear, "posts") - assert_equal "Effect.toggle('posts','slide',{});", visual_effect(:toggle_slide, "posts") - assert_equal "Effect.toggle('posts','blind',{});", visual_effect(:toggle_blind, "posts") - assert_equal "Effect.toggle('posts','appear',{});", visual_effect("toggle_appear", "posts") - assert_equal "Effect.toggle('posts','slide',{});", visual_effect("toggle_slide", "posts") - assert_equal "Effect.toggle('posts','blind',{});", visual_effect("toggle_blind", "posts") + assert_equal "Effect.toggle(\"posts\",'appear',{});", visual_effect(:toggle_appear, "posts") + assert_equal "Effect.toggle(\"posts\",'slide',{});", visual_effect(:toggle_slide, "posts") + assert_equal "Effect.toggle(\"posts\",'blind',{});", visual_effect(:toggle_blind, "posts") + assert_equal "Effect.toggle(\"posts\",'appear',{});", visual_effect("toggle_appear", "posts") + assert_equal "Effect.toggle(\"posts\",'slide',{});", visual_effect("toggle_slide", "posts") + assert_equal "Effect.toggle(\"posts\",'blind',{});", visual_effect("toggle_blind", "posts") end def test_sortable_element - assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nSortable.create('mylist', {onUpdate:function(){new Ajax.Request('http://www.example.com/order', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize('mylist')})}})\n//]]>\n</script>), + assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nSortable.create(\"mylist\", {onUpdate:function(){new Ajax.Request('http://www.example.com/order', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize(\"mylist\")})}})\n//]]>\n</script>), sortable_element("mylist", :url => { :action => "order" }) - assert_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nSortable.create('mylist', {constraint:'horizontal', onUpdate:function(){new Ajax.Request('http://www.example.com/order', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize('mylist')})}, tag:'div'})\n//]]>\n</script>), + assert_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nSortable.create(\"mylist\", {constraint:'horizontal', onUpdate:function(){new Ajax.Request('http://www.example.com/order', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize(\"mylist\")})}, tag:'div'})\n//]]>\n</script>), sortable_element("mylist", :tag => "div", :constraint => "horizontal", :url => { :action => "order" }) - assert_dom_equal %|<script type=\"text/javascript\">\n//<![CDATA[\nSortable.create('mylist', {constraint:'horizontal', containment:['list1','list2'], onUpdate:function(){new Ajax.Request('http://www.example.com/order', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize('mylist')})}})\n//]]>\n</script>|, + assert_dom_equal %|<script type=\"text/javascript\">\n//<![CDATA[\nSortable.create(\"mylist\", {constraint:'horizontal', containment:['list1','list2'], onUpdate:function(){new Ajax.Request('http://www.example.com/order', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize(\"mylist\")})}})\n//]]>\n</script>|, sortable_element("mylist", :containment => ['list1','list2'], :constraint => "horizontal", :url => { :action => "order" }) - assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nSortable.create('mylist', {constraint:'horizontal', containment:'list1', onUpdate:function(){new Ajax.Request('http://www.example.com/order', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize('mylist')})}})\n//]]>\n</script>), + assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nSortable.create(\"mylist\", {constraint:'horizontal', containment:'list1', onUpdate:function(){new Ajax.Request('http://www.example.com/order', {asynchronous:true, evalScripts:true, parameters:Sortable.serialize(\"mylist\")})}})\n//]]>\n</script>), sortable_element("mylist", :containment => 'list1', :constraint => "horizontal", :url => { :action => "order" }) end def test_draggable_element - assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Draggable('product_13', {})\n//]]>\n</script>), - draggable_element('product_13') - assert_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Draggable('product_13', {revert:true})\n//]]>\n</script>), - draggable_element('product_13', :revert => true) + assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Draggable(\"product_13\", {})\n//]]>\n</script>), + draggable_element("product_13") + assert_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Draggable(\"product_13\", {revert:true})\n//]]>\n</script>), + draggable_element("product_13", :revert => true) end def test_drop_receiving_element - assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nDroppables.add('droptarget1', {onDrop:function(element){new Ajax.Request('http://www.example.com/', {asynchronous:true, evalScripts:true, parameters:'id=' + encodeURIComponent(element.id)})}})\n//]]>\n</script>), - drop_receiving_element('droptarget1') - assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nDroppables.add('droptarget1', {accept:'products', onDrop:function(element){new Ajax.Request('http://www.example.com/', {asynchronous:true, evalScripts:true, parameters:'id=' + encodeURIComponent(element.id)})}})\n//]]>\n</script>), - drop_receiving_element('droptarget1', :accept => 'products') - assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nDroppables.add('droptarget1', {accept:'products', onDrop:function(element){new Ajax.Updater('infobox', 'http://www.example.com/', {asynchronous:true, evalScripts:true, parameters:'id=' + encodeURIComponent(element.id)})}})\n//]]>\n</script>), - drop_receiving_element('droptarget1', :accept => 'products', :update => 'infobox') - assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nDroppables.add('droptarget1', {accept:['tshirts','mugs'], onDrop:function(element){new Ajax.Updater('infobox', 'http://www.example.com/', {asynchronous:true, evalScripts:true, parameters:'id=' + encodeURIComponent(element.id)})}})\n//]]>\n</script>), - drop_receiving_element('droptarget1', :accept => ['tshirts','mugs'], :update => 'infobox') + assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nDroppables.add(\"droptarget1\", {onDrop:function(element){new Ajax.Request('http://www.example.com/', {asynchronous:true, evalScripts:true, parameters:'id=' + encodeURIComponent(element.id)})}})\n//]]>\n</script>), + drop_receiving_element("droptarget1") + assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nDroppables.add(\"droptarget1\", {accept:'products', onDrop:function(element){new Ajax.Request('http://www.example.com/', {asynchronous:true, evalScripts:true, parameters:'id=' + encodeURIComponent(element.id)})}})\n//]]>\n</script>), + drop_receiving_element("droptarget1", :accept => 'products') + assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nDroppables.add(\"droptarget1\", {accept:'products', onDrop:function(element){new Ajax.Updater('infobox', 'http://www.example.com/', {asynchronous:true, evalScripts:true, parameters:'id=' + encodeURIComponent(element.id)})}})\n//]]>\n</script>), + drop_receiving_element("droptarget1", :accept => 'products', :update => 'infobox') + assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nDroppables.add(\"droptarget1\", {accept:['tshirts','mugs'], onDrop:function(element){new Ajax.Updater('infobox', 'http://www.example.com/', {asynchronous:true, evalScripts:true, parameters:'id=' + encodeURIComponent(element.id)})}})\n//]]>\n</script>), + drop_receiving_element("droptarget1", :accept => ['tshirts','mugs'], :update => 'infobox') end end
\ No newline at end of file |