diff options
author | Thomas Fuchs <thomas@fesch.at> | 2005-11-01 06:34:40 +0000 |
---|---|---|
committer | Thomas Fuchs <thomas@fesch.at> | 2005-11-01 06:34:40 +0000 |
commit | d47f3bcbade7ea9e9b66fa88d0060236d142675d (patch) | |
tree | b08c4459aefb2da3232fb82b4a0aebed44cb964b /actionpack/test | |
parent | d5859d0b17ccbf5907a2eb2a979257ec6474e677 (diff) | |
download | rails-d47f3bcbade7ea9e9b66fa88d0060236d142675d.tar.gz rails-d47f3bcbade7ea9e9b66fa88d0060236d142675d.tar.bz2 rails-d47f3bcbade7ea9e9b66fa88d0060236d142675d.zip |
Change javascript_include_tag :defaults to not use script.aculo.us loader, which facilitates the use of plugins for future script.aculo.us and third party javascript extensions, and provide register_javascript_include_default for plugins to specify additional JavaScript files to load. Removed scriptaculous.js, slider.js and builder.js
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2835 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/template/asset_tag_helper_test.rb | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/actionpack/test/template/asset_tag_helper_test.rb b/actionpack/test/template/asset_tag_helper_test.rb index 9a242c6a5a..8ec3229547 100644 --- a/actionpack/test/template/asset_tag_helper_test.rb +++ b/actionpack/test/template/asset_tag_helper_test.rb @@ -24,6 +24,7 @@ class AssetTagHelperTest < Test::Unit::TestCase @controller.request = @request + ActionView::Helpers::AssetTagHelper::reset_javascript_include_default end AutoDiscoveryToTag = { @@ -48,6 +49,7 @@ class AssetTagHelperTest < Test::Unit::TestCase %(javascript_include_tag("xmlhr")) => %(<script src="/javascripts/xmlhr.js" type="text/javascript"></script>), %(javascript_include_tag("xmlhr", :lang => "vbscript")) => %(<script lang="vbscript" src="/javascripts/xmlhr.js" type="text/javascript"></script>), %(javascript_include_tag("common.javascript", "/elsewhere/cools")) => %(<script src="/javascripts/common.javascript" type="text/javascript"></script>\n<script src="/elsewhere/cools.js" type="text/javascript"></script>), + %(javascript_include_tag(:defaults)) => %(<script src="/javascripts/prototype.js" type="text/javascript"></script>\n<script src="/javascripts/effects.js" type="text/javascript"></script>\n<script src="/javascripts/dragdrop.js" type="text/javascript"></script>\n<script src="/javascripts/controls.js" type="text/javascript"></script>) } StylePathToTag = { @@ -85,6 +87,13 @@ class AssetTagHelperTest < Test::Unit::TestCase def test_javascript_include JavascriptIncludeToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) } end + + def test_register_javascript_include_default + ActionView::Helpers::AssetTagHelper::register_javascript_include_default 'slider' + assert_dom_equal %(<script src="/javascripts/prototype.js" type="text/javascript"></script>\n<script src="/javascripts/effects.js" type="text/javascript"></script>\n<script src="/javascripts/dragdrop.js" type="text/javascript"></script>\n<script src="/javascripts/controls.js" type="text/javascript"></script>\n<script src="/javascripts/slider.js" type="text/javascript"></script>), javascript_include_tag(:defaults) + ActionView::Helpers::AssetTagHelper::register_javascript_include_default 'lib1', '/elsewhere/blub/lib2' + assert_dom_equal %(<script src="/javascripts/prototype.js" type="text/javascript"></script>\n<script src="/javascripts/effects.js" type="text/javascript"></script>\n<script src="/javascripts/dragdrop.js" type="text/javascript"></script>\n<script src="/javascripts/controls.js" type="text/javascript"></script>\n<script src="/javascripts/slider.js" type="text/javascript"></script>\n<script src="/javascripts/lib1.js" type="text/javascript"></script>\n<script src="/elsewhere/blub/lib2.js" type="text/javascript"></script>), javascript_include_tag(:defaults) + end def test_style_path StylePathToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) } @@ -127,7 +136,8 @@ class AssetTagHelperNonVhostTest < Test::Unit::TestCase end.new @controller.request = @request - + + ActionView::Helpers::AssetTagHelper::reset_javascript_include_default end AutoDiscoveryToTag = { @@ -143,7 +153,7 @@ class AssetTagHelperNonVhostTest < Test::Unit::TestCase JavascriptIncludeToTag = { %(javascript_include_tag("xmlhr")) => %(<script src="/calloboration/hieraki/javascripts/xmlhr.js" type="text/javascript"></script>), %(javascript_include_tag("common.javascript", "/elsewhere/cools")) => %(<script src="/calloboration/hieraki/javascripts/common.javascript" type="text/javascript"></script>\n<script src="/calloboration/hieraki/elsewhere/cools.js" type="text/javascript"></script>), - %(javascript_include_tag(:defaults)) => %(<script src='/calloboration/hieraki/javascripts/prototype.js' type='text/javascript'></script>\n<script src='/calloboration/hieraki/javascripts/scriptaculous.js' type='text/javascript'></script>), + %(javascript_include_tag(:defaults)) => %(<script src="/calloboration/hieraki/javascripts/prototype.js" type="text/javascript"></script>\n<script src="/calloboration/hieraki/javascripts/effects.js" type="text/javascript"></script>\n<script src="/calloboration/hieraki/javascripts/dragdrop.js" type="text/javascript"></script>\n<script src="/calloboration/hieraki/javascripts/controls.js" type="text/javascript"></script>) } StylePathToTag = { @@ -177,6 +187,13 @@ class AssetTagHelperNonVhostTest < Test::Unit::TestCase def test_javascript_include JavascriptIncludeToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) } end + + def test_register_javascript_include_default + ActionView::Helpers::AssetTagHelper::register_javascript_include_default 'slider' + assert_dom_equal %(<script src="/calloboration/hieraki/javascripts/prototype.js" type="text/javascript"></script>\n<script src="/calloboration/hieraki/javascripts/effects.js" type="text/javascript"></script>\n<script src="/calloboration/hieraki/javascripts/dragdrop.js" type="text/javascript"></script>\n<script src="/calloboration/hieraki/javascripts/controls.js" type="text/javascript"></script>\n<script src="/calloboration/hieraki/javascripts/slider.js" type="text/javascript"></script>), javascript_include_tag(:defaults) + ActionView::Helpers::AssetTagHelper::register_javascript_include_default 'lib1', '/elsewhere/blub/lib2' + assert_dom_equal %(<script src="/calloboration/hieraki/javascripts/prototype.js" type="text/javascript"></script>\n<script src="/calloboration/hieraki/javascripts/effects.js" type="text/javascript"></script>\n<script src="/calloboration/hieraki/javascripts/dragdrop.js" type="text/javascript"></script>\n<script src="/calloboration/hieraki/javascripts/controls.js" type="text/javascript"></script>\n<script src="/calloboration/hieraki/javascripts/slider.js" type="text/javascript"></script>\n<script src="/calloboration/hieraki/javascripts/lib1.js" type="text/javascript"></script>\n<script src="/calloboration/hieraki/elsewhere/blub/lib2.js" type="text/javascript"></script>), javascript_include_tag(:defaults) + end def test_style_path StylePathToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) } |