diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-04 04:57:15 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-07-04 04:57:15 +0000 |
commit | bf3a0c539174e7a1f419e2b8a424afab762cd816 (patch) | |
tree | 741e161e035f8a52fa75b923277ace5ddbcaceb0 /actionpack/test/template/javascript_helper.rb | |
parent | cb4bd89741ace5026ce5e05573ce46dd3701f8d7 (diff) | |
download | rails-bf3a0c539174e7a1f419e2b8a424afab762cd816.tar.gz rails-bf3a0c539174e7a1f419e2b8a424afab762cd816.tar.bz2 rails-bf3a0c539174e7a1f419e2b8a424afab762cd816.zip |
Improved update_element_function #1597 [Thomas Fuchs]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1650 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/template/javascript_helper.rb')
-rw-r--r-- | actionpack/test/template/javascript_helper.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/actionpack/test/template/javascript_helper.rb b/actionpack/test/template/javascript_helper.rb index 718c469ba6..8ce94a9d9b 100644 --- a/actionpack/test/template/javascript_helper.rb +++ b/actionpack/test/template/javascript_helper.rb @@ -7,6 +7,7 @@ class JavaScriptHelperTest < Test::Unit::TestCase include ActionView::Helpers::TagHelper include ActionView::Helpers::TextHelper include ActionView::Helpers::FormHelper + include ActionView::Helpers::CaptureHelper def setup @controller = Class.new do @@ -120,4 +121,28 @@ class JavaScriptHelperTest < Test::Unit::TestCase drop_receiving_element('droptarget1', :accept => 'products', :update => 'infobox') end + def test_update_element_function + assert_equal %($('myelement').innerHTML = 'blub';\n), + update_element_function('myelement', :content => 'blub') + assert_equal %($('myelement').innerHTML = 'blub';\n), + update_element_function('myelement', :action => :update, :content => 'blub') + assert_equal %($('myelement').innerHTML = '';\n), + update_element_function('myelement', :action => :empty) + assert_equal %(Element.remove('myelement');\n), + update_element_function('myelement', :action => :remove) + + assert_equal %(new Insertion.Bottom('myelement','blub');\n), + update_element_function('myelement', :position => 'bottom', :content => 'blub') + assert_equal %(new Insertion.Bottom('myelement','blub');\n), + update_element_function('myelement', :action => :update, :position => :bottom, :content => 'blub') + + _erbout = "" + assert_equal %($('myelement').innerHTML = 'test';\n), + update_element_function('myelement') { _erbout << "test" } + + _erbout = "" + assert_equal %($('myelement').innerHTML = 'blockstuff';\n), + update_element_function('myelement', :content => 'paramstuff') { _erbout << "blockstuff" } + end + end |