font-awesome-rails-4.7.0.5/ 0000755 0000041 0000041 00000000000 13460275306 015437 5 ustar www-data www-data font-awesome-rails-4.7.0.5/test/ 0000755 0000041 0000041 00000000000 13460275306 016416 5 ustar www-data www-data font-awesome-rails-4.7.0.5/test/font_awesome_rails_test.rb 0000644 0000041 0000041 00000004152 13460275306 023664 0 ustar www-data www-data require 'test_helper'
class FontAwesomeRailsTest < ActionDispatch::IntegrationTest
teardown { clean_sprockets_cache }
test "engine is loaded" do
assert_equal ::Rails::Engine, FontAwesome::Rails::Engine.superclass
end
test "fonts are served" do
get "/assets/fontawesome-webfont.eot"
assert_response :success
get "/assets/fontawesome-webfont.woff2"
assert_response :success
get "/assets/fontawesome-webfont.woff"
assert_response :success
get "/assets/fontawesome-webfont.ttf"
assert_response :success
get "/assets/fontawesome-webfont.svg"
assert_response :success
end
test "stylesheets are served" do
get "/assets/font-awesome.css"
assert_font_awesome(response)
end
test "stylesheets contain asset pipeline references to fonts" do
get "/assets/font-awesome.css"
assert_match %r{/assets/fontawesome-webfont(-\w+)?\.eot}, response.body
assert_match %r{/assets/fontawesome-webfont(-\w+)?\.eot\?#iefix}, response.body
assert_match %r{/assets/fontawesome-webfont(-\w+)?\.woff2}, response.body
assert_match %r{/assets/fontawesome-webfont(-\w+)?\.woff}, response.body
assert_match %r{/assets/fontawesome-webfont(-\w+)?\.ttf}, response.body
assert_match %r{/assets/fontawesome-webfont(-\w+)?\.svg#fontawesomeregular}, response.body
end
test "stylesheet is available in a css sprockets require" do
get "/assets/sprockets-require.css"
assert_font_awesome(response)
end
test "stylesheet is available in a sass import" do
get "/assets/sass-import.css"
assert_font_awesome(response)
end
test "stylesheet is available in a scss import" do
get "/assets/scss-import.css"
assert_font_awesome(response)
end
test "helpers should be available in the view" do
get "/icons"
assert_response :success
assert_select "i.fa.fa-flag"
assert_select "span.fa-stack"
end
private
def clean_sprockets_cache
FileUtils.rm_rf File.expand_path("../dummy/tmp", __FILE__)
end
def assert_font_awesome(response)
assert_response :success
assert_match(/font-family:\s*'FontAwesome';/, response.body)
end
end
font-awesome-rails-4.7.0.5/test/icon_helper_test.rb 0000644 0000041 0000041 00000014606 13460275306 022300 0 ustar www-data www-data require 'test_helper'
class FontAwesome::Rails::IconHelperTest < ActionView::TestCase
test "#fa_icon with no args should render a flag icon" do
assert_icon i("fa fa-flag")
end
test "#fa_icon should render different individual icons" do
assert_icon i("fa fa-flag"), "flag"
assert_icon i("fa fa-camera-retro"), "camera-retro"
assert_icon i("fa fa-cog"), "cog"
assert_icon i("fa fa-github"), "github"
end
test "#fa_icon should render icons with multiple modifiers" do
assert_icon i("fa fa-pencil fa-fixed-width"), "pencil fixed-width"
assert_icon i("fa fa-flag fa-4x"), "flag 4x"
assert_icon i("fa fa-refresh fa-2x fa-spin"), "refresh 2x spin"
end
test "#fa_icon should render icons with array modifiers" do
assert_icon i("fa fa-flag"), ["flag"]
assert_icon i("fa fa-check fa-li"), ["check", "li"]
assert_icon i("fa fa-flag fa-4x"), ["flag", "4x"]
assert_icon i("fa fa-refresh fa-2x fa-spin"), ["refresh", "2x", "spin"]
end
test "#fa_icon should incorporate additional class styles" do
assert_icon i("fa fa-flag pull-right"), "flag", :class => "pull-right"
assert_icon i("fa fa-flag fa-2x pull-right"), ["flag", "2x"], :class => ["pull-right"]
assert_icon i("fa fa-check fa-li pull-right special"), "check li", :class => "pull-right special"
assert_icon i("fa fa-check pull-right special"), "check", :class => ["pull-right", "special"]
end
test "#fa_icon should incorporate a text suffix" do
assert_icon "#{i("fa fa-camera-retro")} Take a photo", "camera-retro", :text => "Take a photo"
end
test "#fa_icon should be able to put the icon on the right" do
assert_icon "Submit #{i("fa fa-chevron-right")}", "chevron-right", :text => "Submit", :right => true
end
test "#fa_icon should html escape text" do
assert_icon "#{i("fa fa-camera-retro")} <script></script>", "camera-retro", :text => ""
end
test "#fa_icon should not html escape safe text" do
assert_icon "#{i("fa fa-camera-retro")} ", "camera-retro", :text => "".html_safe
end
test "#fa_icon should pull it all together" do
assert_icon "#{i("fa fa-camera-retro pull-right")} Take a photo", "camera-retro", :text => "Take a photo", :class => "pull-right"
end
test "#fa_icon should pass all other options through" do
assert_icon %(), "user", :data => { :id => 123 }
end
test '#fa_icon does not modify options' do
icon_options = { :class => 'foo', :data => { :id => 123 }, :text => 'bar' }
assert_icon %( bar), "user", icon_options
assert_includes icon_options, :class
assert_includes icon_options, :text
assert_includes icon_options, :data
end
test "#fa_stacked_icon with no args should render a flag icon" do
expected = %(#{i("fa fa-square-o fa-stack-2x")}#{i("fa fa-flag fa-stack-1x")})
assert_stacked_icon expected
end
test "#fa_stacked_icon should render a stacked icon" do
expected = %(#{i("fa fa-square-o fa-stack-2x")}#{i("fa fa-twitter fa-stack-1x")})
assert_stacked_icon expected, "twitter", :base => "square-o"
expected = %(#{i("fa fa-square fa-stack-2x")}#{i("fa fa-terminal fa-inverse fa-stack-1x")})
assert_stacked_icon expected, ["terminal", "inverse"], :base => ["square"]
end
test "#fa_stacked_icon should incorporate additional class styles" do
expected = %(#{i("fa fa-square-o fa-stack-2x")}#{i("fa fa-twitter fa-stack-1x")})
assert_stacked_icon expected, "twitter", :base => "square-o", :class => "pull-right"
end
test "#fa_stacked_icon should reverse the stack" do
expected = %(#{i("fa fa-facebook fa-stack-1x")}#{i("fa fa-ban fa-stack-2x")})
assert_stacked_icon expected, "facebook", :base => "ban", :reverse => "true"
end
test "#fa_stacked_icon should be able to put the icon on the right" do
expected = %(Go #{i("fa fa-square-o fa-stack-2x")}#{i("fa fa-exclamation fa-stack-1x")})
assert_stacked_icon expected, "exclamation", :text => "Go", :right => true
end
test "#fa_stacked_icon should html escape text" do
expected = %(#{i("fa fa-check-empty fa-stack-2x")}#{i("fa fa-twitter fa-stack-1x")} <script>)
assert_stacked_icon expected, "twitter", :base => "check-empty", :text => "