diff options
Diffstat (limited to 'actionpack/test/template')
-rw-r--r-- | actionpack/test/template/asset_tag_helper_test.rb | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/actionpack/test/template/asset_tag_helper_test.rb b/actionpack/test/template/asset_tag_helper_test.rb index b4a7567aef..275b987f0e 100644 --- a/actionpack/test/template/asset_tag_helper_test.rb +++ b/actionpack/test/template/asset_tag_helper_test.rb @@ -70,6 +70,12 @@ class AssetTagHelperTest < Test::Unit::TestCase %(javascript_path("/super/xmlhr.js")) => %(/super/xmlhr.js) } + PathToJavascriptToTag = { + %(path_to_javascript("xmlhr")) => %(/javascripts/xmlhr.js), + %(path_to_javascript("super/xmlhr")) => %(/javascripts/super/xmlhr.js), + %(path_to_javascript("/super/xmlhr.js")) => %(/super/xmlhr.js) + } + JavascriptIncludeToTag = { %(javascript_include_tag("xmlhr")) => %(<script src="/javascripts/xmlhr.js" type="text/javascript"></script>), %(javascript_include_tag("xmlhr.js")) => %(<script src="/javascripts/xmlhr.js" type="text/javascript"></script>), @@ -88,6 +94,13 @@ class AssetTagHelperTest < Test::Unit::TestCase %(stylesheet_path('/dir/file.rcss')) => %(/dir/file.rcss) } + PathToStyleToTag = { + %(path_to_stylesheet("style")) => %(/stylesheets/style.css), + %(path_to_stylesheet("style.css")) => %(/stylesheets/style.css), + %(path_to_stylesheet('dir/file')) => %(/stylesheets/dir/file.css), + %(path_to_stylesheet('/dir/file.rcss')) => %(/dir/file.rcss) + } + StyleLinkToTag = { %(stylesheet_link_tag("style")) => %(<link href="/stylesheets/style.css" media="screen" rel="stylesheet" type="text/css" />), %(stylesheet_link_tag("style.css")) => %(<link href="/stylesheets/style.css" media="screen" rel="stylesheet" type="text/css" />), @@ -107,6 +120,13 @@ class AssetTagHelperTest < Test::Unit::TestCase %(image_path("/dir/xml.png")) => %(/dir/xml.png) } + PathToImageToTag = { + %(path_to_image("xml")) => %(/images/xml), + %(path_to_image("xml.png")) => %(/images/xml.png), + %(path_to_image("dir/xml.png")) => %(/images/dir/xml.png), + %(path_to_image("/dir/xml.png")) => %(/dir/xml.png) + } + ImageLinkToTag = { %(image_tag("xml.png")) => %(<img alt="Xml" src="/images/xml.png" />), %(image_tag("rss.gif", :alt => "rss syndication")) => %(<img alt="rss syndication" src="/images/rss.gif" />), @@ -127,6 +147,10 @@ class AssetTagHelperTest < Test::Unit::TestCase JavascriptPathToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) } end + def test_path_to_javascript_alias_for_javascript_path + PathToJavascriptToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) } + end + def test_javascript_include_tag ENV["RAILS_ASSET_ID"] = "" JavascriptIncludeToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) } @@ -149,6 +173,10 @@ class AssetTagHelperTest < Test::Unit::TestCase StylePathToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) } end + def test_path_to_stylesheet_alias_for_stylesheet_path + PathToStyleToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) } + end + def test_stylesheet_link_tag ENV["RAILS_ASSET_ID"] = "" StyleLinkToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) } @@ -159,7 +187,7 @@ class AssetTagHelperTest < Test::Unit::TestCase end def test_path_to_image_alias_for_image_path - ImagePathToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) } + PathToImageToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) } end def test_image_tag |