aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template
diff options
context:
space:
mode:
authorThomas Fuchs <thomas@fesch.at>2006-11-06 09:40:30 +0000
committerThomas Fuchs <thomas@fesch.at>2006-11-06 09:40:30 +0000
commite52e803a5577489022a752827f37dd2ab56a2ac9 (patch)
tree4973ae505b8dbc7bdc6f88da1884758692c1476a /actionpack/test/template
parentba553f94248340b54b32cee1fcbd41295713d180 (diff)
downloadrails-e52e803a5577489022a752827f37dd2ab56a2ac9.tar.gz
rails-e52e803a5577489022a752827f37dd2ab56a2ac9.tar.bz2
rails-e52e803a5577489022a752827f37dd2ab56a2ac9.zip
Deprecate JavaScriptHelper#update_element_function, which is superseeded by RJS [Thomas Fuchs]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5438 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/template')
-rw-r--r--actionpack/test/template/deprecated_helper_test.rb36
-rw-r--r--actionpack/test/template/prototype_helper_test.rb24
2 files changed, 36 insertions, 24 deletions
diff --git a/actionpack/test/template/deprecated_helper_test.rb b/actionpack/test/template/deprecated_helper_test.rb
new file mode 100644
index 0000000000..836bb035b1
--- /dev/null
+++ b/actionpack/test/template/deprecated_helper_test.rb
@@ -0,0 +1,36 @@
+require File.dirname(__FILE__) + '/../abstract_unit'
+
+class DeprecatedHelperTest < Test::Unit::TestCase
+ include ActionView::Helpers::JavaScriptHelper
+ include ActionView::Helpers::CaptureHelper
+
+ def test_update_element_function
+ assert_deprecated 'update_element_function' do
+
+ 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
+
+end
+
diff --git a/actionpack/test/template/prototype_helper_test.rb b/actionpack/test/template/prototype_helper_test.rb
index 256f057615..7dc366b7d9 100644
--- a/actionpack/test/template/prototype_helper_test.rb
+++ b/actionpack/test/template/prototype_helper_test.rb
@@ -143,30 +143,6 @@ class PrototypeHelperTest < Test::Unit::TestCase
assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Form.Observer('cart', 2, function(element, value) {alert('Form changed')})\n//]]>\n</script>),
observe_form("cart", :frequency => 2, :function => "alert('Form changed')")
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
def test_update_page
block = Proc.new { |page| page.replace_html('foo', 'bar') }