diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-06-19 22:03:27 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-06-19 22:21:56 -0700 |
commit | 72f93b581f1d1a7496ccebbd90578714c171c5a5 (patch) | |
tree | 0e89550d0297bba6a87c8eae507c7388d62c92e8 /actionpack/test/template/javascript_helper_test.rb | |
parent | c440c9b199d7474e356472616ef03f9c7e17c405 (diff) | |
download | rails-72f93b581f1d1a7496ccebbd90578714c171c5a5.tar.gz rails-72f93b581f1d1a7496ccebbd90578714c171c5a5.tar.bz2 rails-72f93b581f1d1a7496ccebbd90578714c171c5a5.zip |
Check whether blocks are called from erb using a special __in_erb_template variable visible in block binding.
Diffstat (limited to 'actionpack/test/template/javascript_helper_test.rb')
-rw-r--r-- | actionpack/test/template/javascript_helper_test.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/actionpack/test/template/javascript_helper_test.rb b/actionpack/test/template/javascript_helper_test.rb index 8c649ea544..d6d398d224 100644 --- a/actionpack/test/template/javascript_helper_test.rb +++ b/actionpack/test/template/javascript_helper_test.rb @@ -48,7 +48,7 @@ class JavaScriptHelperTest < ActionView::TestCase end def test_link_to_function_with_href - assert_dom_equal %(<a href="http://example.com/" onclick="alert('Hello world!'); return false;">Greeting</a>), + assert_dom_equal %(<a href="http://example.com/" onclick="alert('Hello world!'); return false;">Greeting</a>), link_to_function("Greeting", "alert('Hello world!')", :href => 'http://example.com/') end @@ -95,12 +95,14 @@ class JavaScriptHelperTest < ActionView::TestCase javascript_tag("alert('hello')", :id => "the_js_tag") end - def test_javascript_tag_with_block + def test_javascript_tag_with_block_in_erb + __in_erb_template = '' javascript_tag { concat "alert('hello')" } assert_dom_equal "<script type=\"text/javascript\">\n//<![CDATA[\nalert('hello')\n//]]>\n</script>", output_buffer end - def test_javascript_tag_with_block_and_options + def test_javascript_tag_with_block_and_options_in_erb + __in_erb_template = '' javascript_tag(:id => "the_js_tag") { concat "alert('hello')" } assert_dom_equal "<script id=\"the_js_tag\" type=\"text/javascript\">\n//<![CDATA[\nalert('hello')\n//]]>\n</script>", output_buffer end |