font-awesome5-rails 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +2 -0
  4. data/Rakefile +12 -0
  5. data/app/assets/fonts/fa-brands-400.eot +0 -0
  6. data/app/assets/fonts/fa-brands-400.svg +1008 -0
  7. data/app/assets/fonts/fa-brands-400.ttf +0 -0
  8. data/app/assets/fonts/fa-brands-400.woff +0 -0
  9. data/app/assets/fonts/fa-brands-400.woff2 +0 -0
  10. data/app/assets/fonts/fa-regular-400.eot +0 -0
  11. data/app/assets/fonts/fa-regular-400.svg +366 -0
  12. data/app/assets/fonts/fa-regular-400.ttf +0 -0
  13. data/app/assets/fonts/fa-regular-400.woff +0 -0
  14. data/app/assets/fonts/fa-regular-400.woff2 +0 -0
  15. data/app/assets/fonts/fa-solid-900.eot +0 -0
  16. data/app/assets/fonts/fa-solid-900.svg +1467 -0
  17. data/app/assets/fonts/fa-solid-900.ttf +0 -0
  18. data/app/assets/fonts/fa-solid-900.woff +0 -0
  19. data/app/assets/fonts/fa-solid-900.woff2 +0 -0
  20. data/app/assets/stylesheets/font-awesome5.css.erb +2695 -0
  21. data/app/helpers/font_awesome5/rails/icon_helper.rb +134 -0
  22. data/lib/font-awesome5-rails.rb +2 -0
  23. data/lib/font-awesome5-rails/engine.rb +6 -0
  24. data/lib/font-awesome5-rails/version.rb +6 -0
  25. data/test/dummy/.gitignore +2 -0
  26. data/test/dummy/app/assets/stylesheets/sass-import.css.sass +1 -0
  27. data/test/dummy/app/assets/stylesheets/scss-import.css.scss +1 -0
  28. data/test/dummy/app/assets/stylesheets/sprockets-require.css +3 -0
  29. data/test/dummy/app/controllers/pages_controller.rb +2 -0
  30. data/test/dummy/app/views/pages/icons.html.erb +5 -0
  31. data/test/dummy/config.ru +3 -0
  32. data/test/dummy/config/application.rb +19 -0
  33. data/test/dummy/config/boot.rb +10 -0
  34. data/test/dummy/config/environment.rb +4 -0
  35. data/test/dummy/config/initializers/secret_token.rb +8 -0
  36. data/test/dummy/config/routes.rb +3 -0
  37. data/test/font_awesome5_rails_test.rb +104 -0
  38. data/test/icon_helper_test.rb +138 -0
  39. data/test/test_helper.rb +7 -0
  40. metadata +147 -0
@@ -0,0 +1,134 @@
1
+ module FontAwesome5
2
+ module Rails
3
+ module IconHelper
4
+ # Creates an icon tag given an icon name and possible icon
5
+ # modifiers.
6
+ #
7
+ # Examples
8
+ #
9
+ # fa_solid_icon "camera-retro"
10
+ # # => <i class="fa fa-camera-retro"></i>
11
+ #
12
+ # fa_solid_icon "camera-retro", text: "Take a photo"
13
+ # # => <i class="fa fa-camera-retro"></i> Take a photo
14
+ # fa_solid_icon "chevron-right", text: "Get started", right: true
15
+ # # => Get started <i class="fa fa-chevron-right"></i>
16
+ #
17
+ # fa_solid_icon "camera-retro 2x"
18
+ # # => <i class="fa fa-camera-retro fa-2x"></i>
19
+ # fa_solid_icon ["camera-retro", "4x"]
20
+ # # => <i class="fa fa-camera-retro fa-4x"></i>
21
+ # fa_solid_icon "spinner spin lg"
22
+ # # => <i class="fa fa-spinner fa-spin fa-lg">
23
+ #
24
+ # fa_solid_icon "quote-left 4x", class: "pull-left"
25
+ # # => <i class="fa fa-quote-left fa-4x pull-left"></i>
26
+ #
27
+ # fa_solid_icon "user", data: { id: 123 }
28
+ # # => <i class="fa fa-user" data-id="123"></i>
29
+ #
30
+ # content_tag(:li, fa_solid_icon("check li", text: "Bulleted list item"))
31
+ # # => <li><i class="fa fa-check fa-li"></i> Bulleted list item</li>
32
+ def fa_solid_icon(names = "camera-retro", original_options = {})
33
+ options = original_options.deep_dup
34
+ classes = ["fas"]
35
+ classes.concat Private.icon_names(names)
36
+ classes.concat Array(options.delete(:class))
37
+ text = options.delete(:text)
38
+ right_icon = options.delete(:right)
39
+ icon = content_tag(:i, nil, options.merge(:class => classes))
40
+ Private.icon_join(icon, text, right_icon)
41
+ end
42
+
43
+ def fa_regular_icon(names = "camera-retro", original_options = {})
44
+ options = original_options.deep_dup
45
+ classes = ["far"]
46
+ classes.concat Private.icon_names(names)
47
+ classes.concat Array(options.delete(:class))
48
+ text = options.delete(:text)
49
+ right_icon = options.delete(:right)
50
+ icon = content_tag(:i, nil, options.merge(:class => classes))
51
+ Private.icon_join(icon, text, right_icon)
52
+ end
53
+
54
+ def fa_light_icon(names = "camera-retro", original_options = {})
55
+ options = original_options.deep_dup
56
+ classes = ["far"]
57
+ classes.concat Private.icon_names(names)
58
+ classes.concat Array(options.delete(:class))
59
+ text = options.delete(:text)
60
+ right_icon = options.delete(:right)
61
+ icon = content_tag(:i, nil, options.merge(:class => classes))
62
+ Private.icon_join(icon, text, right_icon)
63
+ end
64
+
65
+
66
+ def fa_brand_icon(names = "font-awesome", original_options = {})
67
+ options = original_options.deep_dup
68
+ classes = ["fab"]
69
+ classes.concat Private.icon_names(names)
70
+ classes.concat Array(options.delete(:class))
71
+ text = options.delete(:text)
72
+ right_icon = options.delete(:right)
73
+ icon = content_tag(:i, nil, options.merge(:class => classes))
74
+ Private.icon_join(icon, text, right_icon)
75
+ end
76
+
77
+ # Creates an stack set of icon tags given a base icon name, a main icon
78
+ # name, and possible icon modifiers.
79
+ #
80
+ # Examples
81
+ #
82
+ # fa_stacked_icon "twitter", base: "square-o"
83
+ # # => <span class="fa-stack">
84
+ # # => <i class="fa fa-square-o fa-stack-2x"></i>
85
+ # # => <i class="fa fa-twitter fa-stack-1x"></i>
86
+ # # => </span>
87
+ #
88
+ # fa_stacked_icon "terminal inverse", base: "square", class: "pull-right", text: "Hi!"
89
+ # # => <span class="fa-stack pull-right">
90
+ # # => <i class="fa fa-square fa-stack-2x"></i>
91
+ # # => <i class="fa fa-terminal fa-inverse fa-stack-1x"></i>
92
+ # # => </span> Hi!
93
+ #
94
+ # fa_stacked_icon "camera", base: "ban-circle", reverse: true
95
+ # # => <span class="fa-stack">
96
+ # # => <i class="fa fa-camera fa-stack-1x"></i>
97
+ # # => <i class="fa fa-ban-circle fa-stack-2x"></i>
98
+ # # => </span>
99
+ def fa_stacked_icon(names = "flag", original_options = {})
100
+ options = original_options.deep_dup
101
+ classes = Private.icon_names("stack").concat(Array(options.delete(:class)))
102
+ base_names = Private.array_value(options.delete(:base) || "square-o").push("stack-2x")
103
+ names = Private.array_value(names).push("stack-1x")
104
+ base = fa_solid_icon(base_names, options.delete(:base_options) || {})
105
+ icon = fa_solid_icon(names, options.delete(:icon_options) || {})
106
+ icons = [base, icon]
107
+ icons.reverse! if options.delete(:reverse)
108
+ text = options.delete(:text)
109
+ right_icon = options.delete(:right)
110
+ stacked_icon = content_tag(:span, safe_join(icons), options.merge(:class => classes))
111
+ Private.icon_join(stacked_icon, text, right_icon)
112
+ end
113
+
114
+ module Private
115
+ extend ActionView::Helpers::OutputSafetyHelper
116
+
117
+ def self.icon_join(icon, text, reverse_order = false)
118
+ return icon if text.blank?
119
+ elements = [icon, ERB::Util.html_escape(text)]
120
+ elements.reverse! if reverse_order
121
+ safe_join(elements, " ")
122
+ end
123
+
124
+ def self.icon_names(names = [])
125
+ array_value(names).map { |n| "fa-#{n}" }
126
+ end
127
+
128
+ def self.array_value(value = [])
129
+ value.is_a?(Array) ? value : value.to_s.split(/\s+/)
130
+ end
131
+ end
132
+ end
133
+ end
134
+ end
@@ -0,0 +1,2 @@
1
+ require "font-awesome5-rails/version"
2
+ require "font-awesome5-rails/engine" if defined?(::Rails)
@@ -0,0 +1,6 @@
1
+ module FontAwesome5
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module FontAwesome5
2
+ module Rails
3
+ FA_VERSION = "5.0.6"
4
+ VERSION = "1.0.0"
5
+ end
6
+ end
@@ -0,0 +1,2 @@
1
+ /log
2
+ /tmp
@@ -0,0 +1 @@
1
+ @import font-awesome5
@@ -0,0 +1 @@
1
+ @import "font-awesome5";
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require font-awesome5
3
+ */
@@ -0,0 +1,2 @@
1
+ class PagesController < ActionController::Base
2
+ end
@@ -0,0 +1,5 @@
1
+ <%= fa_solid_icon "flag" %>
2
+ <%= fa_regular_icon "flag" %>
3
+ <%= fa_brand_icon "font-awesome" %>
4
+
5
+ <%= fa_stacked_icon "twitter", :base => "check-empty" %>
@@ -0,0 +1,3 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+ require ::File.expand_path('../config/environment', __FILE__)
3
+ run Dummy::Application
@@ -0,0 +1,19 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ # require "rails/all"
4
+ require "sprockets/railtie"
5
+
6
+ Bundler.require(:default, :development)
7
+
8
+ module Dummy
9
+ class Application < Rails::Application
10
+ config.encoding = "utf-8"
11
+ config.assets.enabled = true
12
+ config.assets.version = '1.0'
13
+
14
+ # replacement for environments/*.rb
15
+ config.active_support.deprecation = :stderr
16
+ config.eager_load = false
17
+ config.active_support.test_order = :random rescue nil
18
+ end
19
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ if File.exist?(gemfile)
5
+ ENV['BUNDLE_GEMFILE'] = gemfile
6
+ require 'bundler'
7
+ Bundler.setup
8
+ end
9
+
10
+ $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,4 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+ # Initialize the rails application
4
+ Dummy::Application.initialize!
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ Dummy::Application.config.secret_token = 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef'
8
+ Dummy::Application.config.secret_key_base = 'deadbeef' if Dummy::Application.config.respond_to?(:secret_key_base)
@@ -0,0 +1,3 @@
1
+ Dummy::Application.routes.draw do
2
+ get "/icons", :to => "pages#icons"
3
+ end
@@ -0,0 +1,104 @@
1
+ require 'test_helper'
2
+ class FontAwesome5RailsTest < ActionDispatch::IntegrationTest
3
+ teardown { clean_sprockets_cache }
4
+
5
+ test "engine is loaded" do
6
+ assert_equal ::Rails::Engine, FontAwesome5::Rails::Engine.superclass
7
+ puts "Engine is Loaded"
8
+ end
9
+
10
+ test "fonts are served" do
11
+ get "/assets/fa-brands-400.eot"
12
+ assert_response :success
13
+ get "/assets/fa-brands-400.ttf"
14
+ assert_response :success
15
+ get "/assets/fa-brands-400.woff2"
16
+ assert_response :success
17
+ get "/assets/fa-regular-400.svg"
18
+ assert_response :success
19
+ get "/assets/fa-regular-400.woff"
20
+ assert_response :success
21
+ get "/assets/fa-solid-900.eot"
22
+ assert_response :success
23
+ get "/assets/fa-solid-900.ttf"
24
+ assert_response :success
25
+ get "/assets/fa-solid-900.woff2"
26
+ assert_response :success
27
+ get "/assets/fa-brands-400.svg"
28
+ assert_response :success
29
+ get "/assets/fa-brands-400.woff"
30
+ assert_response :success
31
+ get "/assets/fa-regular-400.eot"
32
+ assert_response :success
33
+ get "/assets/fa-regular-400.ttf"
34
+ assert_response :success
35
+ get "/assets/fa-regular-400.woff2"
36
+ assert_response :success
37
+ get "/assets/fa-solid-900.svg"
38
+ assert_response :success
39
+ get "/assets/fa-solid-900.woff"
40
+ assert_response :success
41
+ puts "Fonts are served"
42
+
43
+ end
44
+
45
+
46
+ test "stylesheets are served" do
47
+ get "/assets/font-awesome5.css"
48
+ assert_font_awesome(response)
49
+ end
50
+
51
+ test "stylesheets contain asset pipeline references to fonts" do
52
+ get "/assets/font-awesome5.css"
53
+ assert_match %r{/assets/fa-brands-400(-\w+)?\.eot}, response.body
54
+ assert_match %r{/assets/fa-brands-400(-\w+)?\.ttf}, response.body
55
+ assert_match %r{/assets/fa-brands-400(-\w+)?\.woff2}, response.body
56
+ assert_match %r{/assets/fa-regular-400(-\w+)?\.svg}, response.body
57
+ assert_match %r{/assets/fa-regular-400(-\w+)?\.woff}, response.body
58
+ assert_match %r{/assets/fa-solid-900(-\w+)?\.eot}, response.body
59
+ assert_match %r{/assets/fa-solid-900(-\w+)?\.ttf}, response.body
60
+ assert_match %r{/assets/fa-solid-900(-\w+)?\.woff2}, response.body
61
+ assert_match %r{/assets/fa-brands-400(-\w+)?\.svg}, response.body
62
+ assert_match %r{/assets/fa-brands-400(-\w+)?\.woff}, response.body
63
+ assert_match %r{/assets/fa-regular-400(-\w+)?\.eot}, response.body
64
+ assert_match %r{/assets/fa-regular-400(-\w+)?\.ttf}, response.body
65
+ assert_match %r{/assets/fa-regular-400(-\w+)?\.woff2}, response.body
66
+ assert_match %r{/assets/fa-solid-900(-\w+)?\.svg}, response.body
67
+ assert_match %r{/assets/fa-solid-900(-\w+)?\.woff}, response.body
68
+ end
69
+
70
+ test "stylesheet is available in a css sprockets require" do
71
+ get "/assets/sprockets-require.css"
72
+ assert_font_awesome(response)
73
+ end
74
+
75
+ test "stylesheet is available in a sass import" do
76
+ get "/assets/sass-import.css"
77
+ assert_font_awesome(response)
78
+ end
79
+
80
+ test "stylesheet is available in a scss import" do
81
+ get "/assets/scss-import.css"
82
+ assert_font_awesome(response)
83
+ end
84
+
85
+ test "helpers should be available in the view" do
86
+ get "/icons"
87
+ assert_response :success
88
+ assert_select "i.fas.fa-flag"
89
+ assert_select "i.far.fa-flag"
90
+ assert_select "i.fab.fa-font-awesome"
91
+ assert_select "span.fa-stack"
92
+ end
93
+
94
+ private
95
+
96
+ def clean_sprockets_cache
97
+ FileUtils.rm_rf File.expand_path("../dummy/tmp", __FILE__)
98
+ end
99
+
100
+ def assert_font_awesome(response)
101
+ assert_response :success
102
+ assert_match(/font-family:\s*'Font Awesome/, response.body)
103
+ end
104
+ end
@@ -0,0 +1,138 @@
1
+ require 'test_helper'
2
+
3
+ class FontAwesome5::Rails::IconHelperTest < ActionView::TestCase
4
+
5
+ test "#fa_solid_icon with no args should render a flag icon" do
6
+ assert_icon i("fas fa-camera-retro")
7
+ end
8
+
9
+ test "#fa_solid_icon should render different individual icons" do
10
+ assert_icon i("fas fa-flag"), "flag"
11
+ assert_icon i("fas fa-camera-retro"), "camera-retro"
12
+ assert_icon i("fas fa-cog"), "cog"
13
+ assert_icon i("fas fa-github"), "github"
14
+ end
15
+
16
+ test "#fa_solid_icon should render icons with multiple modifiers" do
17
+ assert_icon i("fas fa-pencil fa-fixed-width"), "pencil fixed-width"
18
+ assert_icon i("fas fa-flag fa-4x"), "flag 4x"
19
+ assert_icon i("fas fa-refresh fa-2x fa-spin"), "refresh 2x spin"
20
+ end
21
+
22
+ test "#fa_solid_icon should render icons with array modifiers" do
23
+ assert_icon i("fas fa-flag"), ["flag"]
24
+ assert_icon i("fas fa-check fa-li"), ["check", "li"]
25
+ assert_icon i("fas fa-flag fa-4x"), ["flag", "4x"]
26
+ assert_icon i("fas fa-refresh fa-2x fa-spin"), ["refresh", "2x", "spin"]
27
+ end
28
+
29
+ test "#fa_solid_icon should incorporate additional class styles" do
30
+ assert_icon i("fas fa-flag pull-right"), "flag", :class => "pull-right"
31
+ assert_icon i("fas fa-flag fa-2x pull-right"), ["flag", "2x"], :class => ["pull-right"]
32
+ assert_icon i("fas fa-check fa-li pull-right special"), "check li", :class => "pull-right special"
33
+ assert_icon i("fas fa-check pull-right special"), "check", :class => ["pull-right", "special"]
34
+ end
35
+
36
+ test "#fa_solid_icon should incorporate a text suffix" do
37
+ assert_icon "#{i("fas fa-camera-retro")} Take a photo", "camera-retro", :text => "Take a photo"
38
+ end
39
+
40
+ test "#fa_solid_icon should be able to put the icon on the right" do
41
+ assert_icon "Submit #{i("fas fa-chevron-right")}", "chevron-right", :text => "Submit", :right => true
42
+ end
43
+
44
+ test "#fa_solid_icon should html escape text" do
45
+ assert_icon "#{i("fas fa-camera-retro")} &lt;script&gt;&lt;/script&gt;", "camera-retro", :text => "<script></script>"
46
+ end
47
+
48
+ test "#fa_solid_icon should not html escape safe text" do
49
+ assert_icon "#{i("fas fa-camera-retro")} <script></script>", "camera-retro", :text => "<script></script>".html_safe
50
+ end
51
+
52
+ test "#fa_solid_icon should pull it all together" do
53
+ assert_icon "#{i("fas fa-camera-retro pull-right")} Take a photo", "camera-retro", :text => "Take a photo", :class => "pull-right"
54
+ end
55
+
56
+ test "#fa_solid_icon should pass all other options through" do
57
+ assert_icon %(<i class="fas fa-user" data-id="123"></i>), "user", :data => { :id => 123 }
58
+ end
59
+
60
+ test '#fa_solid_icon does not modify options' do
61
+ icon_options = { :class => 'foo', :data => { :id => 123 }, :text => 'bar' }
62
+ assert_icon %(<i class="fas fa-user foo" data-id="123"></i> bar), "user", icon_options
63
+ assert_includes icon_options, :class
64
+ assert_includes icon_options, :text
65
+ assert_includes icon_options, :data
66
+ end
67
+
68
+ test "#fa_stacked_icon with no args should render a flag icon" do
69
+ expected = %(<span class="fa-stack">#{i("fas fa-square-o fa-stack-2x")}#{i("fas fa-flag fa-stack-1x")}</span>)
70
+ assert_stacked_icon expected
71
+ end
72
+
73
+ test "#fa_stacked_icon should render a stacked icon" do
74
+ expected = %(<span class="fa-stack">#{i("fas fa-square-o fa-stack-2x")}#{i("fas fa-twitter fa-stack-1x")}</span>)
75
+ assert_stacked_icon expected, "twitter", :base => "square-o"
76
+ expected = %(<span class="fa-stack">#{i("fas fa-square fa-stack-2x")}#{i("fas fa-terminal fa-inverse fa-stack-1x")}</span>)
77
+ assert_stacked_icon expected, ["terminal", "inverse"], :base => ["square"]
78
+ end
79
+
80
+ test "#fa_stacked_icon should incorporate additional class styles" do
81
+ expected = %(<span class="fa-stack pull-right">#{i("fas fa-square-o fa-stack-2x")}#{i("fas fa-twitter fa-stack-1x")}</span>)
82
+ assert_stacked_icon expected, "twitter", :base => "square-o", :class => "pull-right"
83
+ end
84
+
85
+ test "#fa_stacked_icon should reverse the stack" do
86
+ expected = %(<span class="fa-stack">#{i("fas fa-facebook fa-stack-1x")}#{i("fas fa-ban fa-stack-2x")}</span>)
87
+ assert_stacked_icon expected, "facebook", :base => "ban", :reverse => "true"
88
+ end
89
+
90
+ test "#fa_stacked_icon should be able to put the icon on the right" do
91
+ expected = %(Go <span class="fa-stack">#{i("fas fa-square-o fa-stack-2x")}#{i("fas fa-exclamation fa-stack-1x")}</span>)
92
+ assert_stacked_icon expected, "exclamation", :text => "Go", :right => true
93
+ end
94
+
95
+ test "#fa_stacked_icon should html escape text" do
96
+ expected = %(<span class="fa-stack">#{i("fas fa-check-empty fa-stack-2x")}#{i("fas fa-twitter fa-stack-1x")}</span> &lt;script&gt;)
97
+ assert_stacked_icon expected, "twitter", :base => "check-empty", :text => "<script>"
98
+ end
99
+
100
+ test "#fa_stacked_icon should not html escape safe text" do
101
+ expected = %(<span class="fa-stack">#{i("fas fa-square-o fa-stack-2x")}#{i("fas fa-twitter fa-stack-1x")}</span> <script>)
102
+ assert_stacked_icon expected, "twitter", :base => "square-o", :text => "<script>".html_safe
103
+ end
104
+
105
+ test "#fa_stacked_icon should accept options for base and main icons" do
106
+ expected = %(<span class="fa-stack">#{i("fas fa-camera fa-stack-1x text-info")}#{i("fas fa-ban fa-stack-2x text-error")}</span>)
107
+ assert_stacked_icon expected, "camera", :base => "ban", :reverse => true, :base_options => { :class => "text-error" }, :icon_options => { :class => "text-info" }
108
+ end
109
+
110
+ test "#fa_stacked_icon should pass all other options through" do
111
+ expected = %(<span class="fa-stack" data-id="123">#{i("fas fa-square-o fa-stack-2x")}#{i("fas fa-user fa-stack-1x")}</span>)
112
+ assert_stacked_icon expected, "user", :base => "square-o", :data => { :id => 123 }
113
+ end
114
+
115
+ test '#fa_stacked_icon does not modify options' do
116
+ icon_options = { :class => 'foo', :base => "square-o", :data => { :id => 123 } }
117
+ expected = %(<span class="fa-stack foo" data-id="123">#{i("fas fa-square-o fa-stack-2x")}#{i("fas fa-user fa-stack-1x")}</span>)
118
+ assert_stacked_icon expected, "user", icon_options
119
+ assert_includes icon_options, :class
120
+ assert_includes icon_options, :data
121
+ end
122
+
123
+ private
124
+
125
+ def assert_icon(expected, *args)
126
+ message = "`fa_solid_icon(#{args.inspect[1...-1]})` should return `#{expected}`"
127
+ assert_dom_equal expected, fa_solid_icon(*args), message
128
+ end
129
+
130
+ def assert_stacked_icon(expected, *args)
131
+ message = "`fa_stacked_icon(#{args.inspect[1...-1]})` should return `#{expected}`"
132
+ assert_dom_equal expected, fa_stacked_icon(*args), message
133
+ end
134
+
135
+ def i(classes)
136
+ %(<i class="#{classes}"></i>)
137
+ end
138
+ end