diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-10-03 09:42:04 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-03 09:42:04 +0900 |
commit | e0d2207ab321145c117c6d615ce209c6f873605d (patch) | |
tree | 3969c936445684df14c118371473baed1ee93f62 /actionview | |
parent | b90a7e3457f6d7019dfc315873617d6d14fcf741 (diff) | |
parent | b407b5973552e266f3797285721438b304e3a7b7 (diff) | |
download | rails-e0d2207ab321145c117c6d615ce209c6f873605d.tar.gz rails-e0d2207ab321145c117c6d615ce209c6f873605d.tar.bz2 rails-e0d2207ab321145c117c6d615ce209c6f873605d.zip |
Merge pull request #30786 from y-yagi/add_test_case_for_font_url
Add test case for `font_url`
Diffstat (limited to 'actionview')
-rw-r--r-- | actionview/test/template/asset_tag_helper_test.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/actionview/test/template/asset_tag_helper_test.rb b/actionview/test/template/asset_tag_helper_test.rb index 6645839f0e..182d8f89f7 100644 --- a/actionview/test/template/asset_tag_helper_test.rb +++ b/actionview/test/template/asset_tag_helper_test.rb @@ -305,6 +305,24 @@ class AssetTagHelperTest < ActionView::TestCase %(font_path("font.ttf?123")) => %(/fonts/font.ttf?123) } + FontUrlToTag = { + %(font_url("font.eot")) => %(http://www.example.com/fonts/font.eot), + %(font_url("font.eot#iefix")) => %(http://www.example.com/fonts/font.eot#iefix), + %(font_url("font.woff")) => %(http://www.example.com/fonts/font.woff), + %(font_url("font.ttf")) => %(http://www.example.com/fonts/font.ttf), + %(font_url("font.ttf?123")) => %(http://www.example.com/fonts/font.ttf?123), + %(font_url("font.ttf", host: "http://assets.example.com")) => %(http://assets.example.com/fonts/font.ttf) + } + + UrlToFontToTag = { + %(url_to_font("font.eot")) => %(http://www.example.com/fonts/font.eot), + %(url_to_font("font.eot#iefix")) => %(http://www.example.com/fonts/font.eot#iefix), + %(url_to_font("font.woff")) => %(http://www.example.com/fonts/font.woff), + %(url_to_font("font.ttf")) => %(http://www.example.com/fonts/font.ttf), + %(url_to_font("font.ttf?123")) => %(http://www.example.com/fonts/font.ttf?123), + %(url_to_font("font.ttf", host: "http://assets.example.com")) => %(http://assets.example.com/fonts/font.ttf) + } + def test_autodiscovery_link_tag_with_unknown_type_but_not_pass_type_option_key assert_raise(ArgumentError) do auto_discovery_link_tag(:xml) @@ -547,6 +565,14 @@ class AssetTagHelperTest < ActionView::TestCase FontPathToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) } end + def test_font_url + FontUrlToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) } + end + + def test_url_to_font_alias_for_font_url + UrlToFontToTag.each { |method, tag| assert_dom_equal(tag, eval(method)) } + end + def test_video_audio_tag_does_not_modify_options options = { autoplay: true } video_tag("video", options) |