aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/javascript_helper.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-06-26 12:03:43 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-06-26 12:03:43 +0000
commit7da736f929e88f4730f160d28afc90667c26b966 (patch)
tree48e46a9dfe62728de3443bc43cdd14db30ef68ce /actionpack/test/template/javascript_helper.rb
parent66d99c913e1ad549b1880bbceb6f7561040d47b4 (diff)
downloadrails-7da736f929e88f4730f160d28afc90667c26b966.tar.gz
rails-7da736f929e88f4730f160d28afc90667c26b966.tar.bz2
rails-7da736f929e88f4730f160d28afc90667c26b966.zip
Added script.aculo.us Javascripts (controls.js, dragdrop.js, effects.js) (NEEDS MORE DESCRIPTION) #1509 [Thomas Fuchs]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1522 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/template/javascript_helper.rb')
-rw-r--r--actionpack/test/template/javascript_helper.rb24
1 files changed, 23 insertions, 1 deletions
diff --git a/actionpack/test/template/javascript_helper.rb b/actionpack/test/template/javascript_helper.rb
index e8395e6753..f70703c819 100644
--- a/actionpack/test/template/javascript_helper.rb
+++ b/actionpack/test/template/javascript_helper.rb
@@ -16,6 +16,11 @@ class JavascriptHelperTest < Test::Unit::TestCase
end
@controller = @controller.new
end
+
+ def test_define_javascript_functions
+ # check if prototype.js is included first
+ assert_not_nil define_javascript_functions.split("\n")[1].match(/Prototype: an object-oriented Javascript library/)
+ end
def test_escape_javascript
assert_equal %(This \\"thing\\" is really\\n netos\\'), escape_javascript(%(This "thing" is really\n netos'))
@@ -39,7 +44,7 @@ class JavascriptHelperTest < Test::Unit::TestCase
end
def test_form_remote_tag
- assert_equal %(<form onsubmit="new Ajax.Updater('glass_of_beer', 'http://www.example.com/fast', {parameters:Form.serialize(this), asynchronous:true}); return false;">),
+ assert_equal %(<form action="http://www.example.com/fast" method="post" onsubmit="new Ajax.Updater('glass_of_beer', 'http://www.example.com/fast', {parameters:Form.serialize(this), asynchronous:true}); return false;">),
form_remote_tag(:update => "glass_of_beer", :url => { :action => :fast })
end
@@ -58,4 +63,21 @@ class JavascriptHelperTest < Test::Unit::TestCase
observe_form("cart", :frequency => 2, :url => { :action => "cart_changed" })
end
+ def test_remote_autocomplete
+ assert_equal %(<script type="text/javascript">new Ajax.Autocompleter('some_input', 'some_input_autocomplete', 'http://www.example.com/autocomplete', {})</script>),
+ remote_autocomplete("some_input", :url => { :action => "autocomplete" });
+ 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)
+ end
+
+ def test_remote_sortable
+ assert_equal %(<script type="text/javascript">Sortable.create('mylist',{onUpdate:function(){new Ajax.Request('http://www.example.com/order', {parameters:Sortable.serialize('mylist'), asynchronous:true})}})</script>),
+ remote_sortable("mylist", :url => { :action => "order" })
+ end
+
end