fa_rails 0.1.31 → 0.1.33

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e75c0e9608f41e199502dd2feb1157b8f1fb2e83c6fef273d9655b267e7c0a1
4
- data.tar.gz: 421e5312e5988e3fa5039c5269b37259f21a2e60b06bc28d1b3de910b4e1e0c6
3
+ metadata.gz: ca2a329b85fbd1dd2b3081cb3b4e76476569dd548628a36ad7c427d50f1fa871
4
+ data.tar.gz: dd9b54e4d2a055acd7dc07bb225f6289cff98c5b4f4ef17974dde8195dc85797
5
5
  SHA512:
6
- metadata.gz: b57d25bacf152ba1651c70d224c9cce0dd19ece29226572783c31a4ebab2bce3b97d7ff864a000fcd71f4d674dd601bf1578e3eee4ce77a5c75514e04d5fd8ee
7
- data.tar.gz: fc339b05b167b9a35f73006495b4458dd8458a263e93d48d987a1fe59c2028581966794cf2e8cc89b90095b52ae6b060ee2106ef1a8193545092ac0f30fa219f
6
+ metadata.gz: 4875fd4c4530391ad87130c509ff92e6e03e331a7f8e2c60d84a1e2117eef8b463fe0e3e5041ed952bea556bce6be1e97a910c6130d0d38b3dc8a93890446d6b
7
+ data.tar.gz: 0c800e60013097d6c0a89c68bd0f6122dbd938ea50e62803039e3f505d2006fb2eefe4b5c7774f809f99e45134cd6ab5820f0728c96d740dd7117b0960e26ac0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fa_rails (0.1.31)
4
+ fa_rails (0.1.33)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/fa_rails.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'fa_rails'
3
- s.version = '0.1.31'
4
- s.date = '2023-03-28'
3
+ s.version = '0.1.33'
4
+ s.date = '2023-07-21'
5
5
  s.summary = 'FontAwesome helper for Rails'
6
6
  s.description = 'A helper module for using FontAwesome icons in Rails.'
7
7
  s.homepage = 'http://rubygems.org/gems/fa_rails'
data/lib/fa/base.rb CHANGED
@@ -54,8 +54,8 @@ module FA
54
54
  css = @classes.flatten.join(' ').sub(/\A\s+/, '')
55
55
  transforms = @transforms.join(' ')
56
56
 
57
- "<i class='#{css}' style='#{@styles}' data-fa-transform='#{transforms}' " \
58
- "title='#{options[:title]}'></i>"
57
+ "<i class='#{css}' id='#{options[:id]}' style='#{@styles}' " \
58
+ "data-fa-transform='#{transforms}' title='#{options[:title]}'></i>"
59
59
  end
60
60
 
61
61
  def parse_span(type, text, options = {})
@@ -70,7 +70,8 @@ module FA
70
70
  css = @classes.flatten.reject { |c| c.to_s.match?(/^fa.$/) }.join(' ')
71
71
  transforms = @transforms.join(' ')
72
72
 
73
- "<span class='#{css}' style='#{@styles}' data-fa-transform='#{transforms}'>#{text}</span>"
73
+ "<span class='#{css}' id='#{options[:id]}' style='#{@styles}' " \
74
+ "data-fa-transform='#{transforms}'>#{text}</span>"
74
75
  end
75
76
 
76
77
  def fa_options(options)
data/lib/fa/link.rb CHANGED
@@ -23,7 +23,7 @@ module FA
23
23
 
24
24
  # Outputs the formatted kit link directly.
25
25
  def kit
26
- "<script src=\"https://kit.fontawesome.com/#{@kit}.js\"></script>"
26
+ "<script src=\"https://kit.fontawesome.com/#{@kit}.js\" async></script>"
27
27
  end
28
28
 
29
29
  def self.kit(kit_id)
data/spec/lib/fa_spec.rb CHANGED
@@ -16,7 +16,7 @@ RSpec.describe FA do
16
16
  it 'generates the correct kit link tag' do
17
17
  tag = FA::Link.kit('abcdefg')
18
18
  expect(tag).to eql(
19
- "<script src=\"https://kit.fontawesome.com/abcdefg.js\"></script>"
19
+ "<script src=\"https://kit.fontawesome.com/abcdefg.js\" async></script>"
20
20
  )
21
21
  end
22
22
 
@@ -30,50 +30,50 @@ RSpec.describe FA do
30
30
  describe 'icon' do
31
31
  it 'generates the correct icon from a string name' do
32
32
  expect(FA::Icon.p('help')).to eql(
33
- "<i class='fas fa-help fa-1x' style='' data-fa-transform='' title=''></i>"
33
+ "<i class='fas fa-help fa-1x' id='' style='' data-fa-transform='' title=''></i>"
34
34
  )
35
35
  end
36
36
 
37
37
  it 'generates the correct icon from a symbol name' do
38
38
  expect(FA::Icon.p(:help)).to eql(
39
- "<i class='fas fa-help fa-1x' style='' data-fa-transform='' title=''></i>"
39
+ "<i class='fas fa-help fa-1x' id='' style='' data-fa-transform='' title=''></i>"
40
40
  )
41
41
  end
42
42
 
43
43
  it 'generates the correct icon from a configuration hash' do
44
44
  fa = { name: 'help', options: { style: :light, size: 2 } }
45
45
  expect(FA::Icon.p(fa)).to eql(
46
- "<i class='fal fa-help fa-2x' style='' data-fa-transform='' title=''></i>"
46
+ "<i class='fal fa-help fa-2x' id='' style='' data-fa-transform='' title=''></i>"
47
47
  )
48
48
  end
49
49
 
50
50
  it 'handles a string fa option' do
51
51
  expect(FA::Icon.p(:help, fa: 'fw 2x')).to eql(
52
- "<i class='fas fa-fw fa-2x fa-help fa-1x' style='' data-fa-transform='' title=''></i>"
52
+ "<i class='fas fa-fw fa-2x fa-help fa-1x' id='' style='' data-fa-transform='' title=''></i>"
53
53
  )
54
54
  end
55
55
 
56
56
  it 'handles an array fa option' do
57
57
  expect(FA::Icon.p(:help, fa: %i[fw 2x])).to eql(
58
- "<i class='fas fa-fw fa-2x fa-help fa-1x' style='' data-fa-transform='' title=''></i>"
58
+ "<i class='fas fa-fw fa-2x fa-help fa-1x' id='' style='' data-fa-transform='' title=''></i>"
59
59
  )
60
60
  end
61
61
 
62
62
  it 'handles a string css option' do
63
63
  expect(FA::Icon.p(:help, css: 'green big')).to eql(
64
- "<i class='fas green big fa-help fa-1x' style='' data-fa-transform='' title=''></i>"
64
+ "<i class='fas green big fa-help fa-1x' id='' style='' data-fa-transform='' title=''></i>"
65
65
  )
66
66
  end
67
67
 
68
68
  it 'handles an array css option' do
69
69
  expect(FA::Icon.p(:help, css: %i[green big])).to eql(
70
- "<i class='fas green big fa-help fa-1x' style='' data-fa-transform='' title=''></i>"
70
+ "<i class='fas green big fa-help fa-1x' id='' style='' data-fa-transform='' title=''></i>"
71
71
  )
72
72
  end
73
73
 
74
74
  it 'handles a nil css option' do
75
75
  expect(FA::Icon.p(:help, css: nil)).to eql(
76
- "<i class='fas fa-help fa-1x' style='' data-fa-transform='' title=''></i>"
76
+ "<i class='fas fa-help fa-1x' id='' style='' data-fa-transform='' title=''></i>"
77
77
  )
78
78
  end
79
79
 
@@ -87,31 +87,31 @@ RSpec.describe FA do
87
87
 
88
88
  it 'generates the correct icon with a manual style class' do
89
89
  expect(FA::Icon.p(:help, style: :solid, css: 'fad')).to eql(
90
- "<i class='fad fa-help fa-1x' style='' data-fa-transform='' title=''></i>"
90
+ "<i class='fad fa-help fa-1x' id='' style='' data-fa-transform='' title=''></i>"
91
91
  )
92
92
  end
93
93
 
94
94
  it 'generates the correct brand icon' do
95
95
  expect(FA::Icon.p(:github, style: :brands)).to eql(
96
- "<i class='fab fa-github fa-1x' style='' data-fa-transform='' title=''></i>"
96
+ "<i class='fab fa-github fa-1x' id='' style='' data-fa-transform='' title=''></i>"
97
97
  )
98
98
  end
99
99
 
100
100
  it 'generates the correct sharp icon' do
101
101
  expect(FA::Icon.p(:house, mode: :sharp)).to eql(
102
- "<i class='fass fa-house fa-1x' style='' data-fa-transform='' title=''></i>"
102
+ "<i class='fass fa-house fa-1x' id='' style='' data-fa-transform='' title=''></i>"
103
103
  )
104
104
  end
105
105
 
106
106
  it 'generates the correct sharp regular icon' do
107
107
  expect(FA::Icon.p(:house, style: :regular, mode: :sharp)).to eql(
108
- "<i class='fasr fa-house fa-1x' style='' data-fa-transform='' title=''></i>"
108
+ "<i class='fasr fa-house fa-1x' id='' style='' data-fa-transform='' title=''></i>"
109
109
  )
110
110
  end
111
111
 
112
112
  it 'generates the correct sharp light icon' do
113
113
  expect(FA::Icon.p(:house, style: :light, mode: :sharp)).to eql(
114
- "<i class='fasl fa-house fa-1x' style='' data-fa-transform='' title=''></i>"
114
+ "<i class='fasl fa-house fa-1x' id='' style='' data-fa-transform='' title=''></i>"
115
115
  )
116
116
  end
117
117
 
@@ -123,7 +123,7 @@ RSpec.describe FA do
123
123
  }
124
124
  )
125
125
  ).to eql(
126
- "<i class='fad fa-fire-alt fa-1x' style='--fa-primary-opacity: 0.6; --fa-secondary-opacity: 0.4; " \
126
+ "<i class='fad fa-fire-alt fa-1x' id='' style='--fa-primary-opacity: 0.6; --fa-secondary-opacity: 0.4; " \
127
127
  "--fa-primary-color: green; --fa-secondary-color: #DD2200;' data-fa-transform='' title=''></i>"
128
128
  )
129
129
  end
@@ -139,9 +139,9 @@ RSpec.describe FA do
139
139
 
140
140
  expect(FA::Layer.p(icons, grow: 2)).to eql(
141
141
  "<span class='icon fa-layers fa-stack fa-fw ' title=''>" \
142
- "<i class='fas fa-stack-1x fa-square fa-1x' style='' data-fa-transform='grow-2' title=''></i>" \
143
- "<i class='fas fa-stack-1x fa-circle fa-1x' style='' data-fa-transform='grow-3' title=''></i>" \
144
- "<i class='far fa-stack-1x fa-exclamation fa-1x' style='' data-fa-transform='grow-2' title=''></i>" \
142
+ "<i class='fas fa-stack-1x fa-square fa-1x' id='' style='' data-fa-transform='grow-2' title=''></i>" \
143
+ "<i class='fas fa-stack-1x fa-circle fa-1x' id='' style='' data-fa-transform='grow-3' title=''></i>" \
144
+ "<i class='far fa-stack-1x fa-exclamation fa-1x' id='' style='' data-fa-transform='grow-2' title=''></i>" \
145
145
  '</span>'
146
146
  )
147
147
  end
@@ -154,8 +154,8 @@ RSpec.describe FA do
154
154
 
155
155
  expect(FA::Layer.p(icons)).to eql(
156
156
  "<span class='icon fa-layers fa-stack fa-fw ' title=''>" \
157
- "<i class='fas fa-stack-1x fa-square fa-1x' style='' data-fa-transform='grow-0' title=''></i>" \
158
- "<span class='fa-stack-1x fa-layers-counter fa-layers-top-left' style='' data-fa-transform='grow-0'>17</span>" \
157
+ "<i class='fas fa-stack-1x fa-square fa-1x' id='' style='' data-fa-transform='grow-0' title=''></i>" \
158
+ "<span class='fa-stack-1x fa-layers-counter fa-layers-top-left' id='' style='' data-fa-transform='grow-0'>17</span>" \
159
159
  '</span>'
160
160
  )
161
161
  end
@@ -168,8 +168,8 @@ RSpec.describe FA do
168
168
 
169
169
  expect(FA::Layer.p(icons, title: 'right')).to eql(
170
170
  "<span class='icon fa-layers fa-stack fa-fw ' title='right'>" \
171
- "<i class='fas fa-stack-1x fa-square fa-1x' style='' data-fa-transform='grow-0' title='right'></i>" \
172
- "<i class='fas fa-stack-1x fa-exclamation fa-1x' style='' data-fa-transform='grow-0' title='right'></i>" \
171
+ "<i class='fas fa-stack-1x fa-square fa-1x' id='' style='' data-fa-transform='grow-0' title='right'></i>" \
172
+ "<i class='fas fa-stack-1x fa-exclamation fa-1x' id='' style='' data-fa-transform='grow-0' title='right'></i>" \
173
173
  '</span>'
174
174
  )
175
175
  end
@@ -184,8 +184,8 @@ RSpec.describe FA do
184
184
 
185
185
  expect(layer).to eql(
186
186
  "<span class='icon fa-layers fa-stack fa-fw ' title=''>" \
187
- "<i class='fas fa-stack-1x fa-circle fa-1x' style='' data-fa-transform='grow-0' title=''></i>" \
188
- "<span class='fa-stack-1x fa-layers-counter ' style='' data-fa-transform='grow-0'>7</span>" \
187
+ "<i class='fas fa-stack-1x fa-circle fa-1x' id='' style='' data-fa-transform='grow-0' title=''></i>" \
188
+ "<span class='fa-stack-1x fa-layers-counter ' id='' style='' data-fa-transform='grow-0'>7</span>" \
189
189
  '</span>'
190
190
  )
191
191
  end
@@ -194,7 +194,7 @@ RSpec.describe FA do
194
194
  describe 'span' do
195
195
  it 'generates the correct span from a string or symbol type' do
196
196
  expect(FA::Span.p(:text, 'Hello')).to eql(
197
- "<span class='fa-layers-text ' style='' data-fa-transform=''>Hello</span>"
197
+ "<span class='fa-layers-text ' id='' style='' data-fa-transform=''>Hello</span>"
198
198
  )
199
199
  end
200
200
 
@@ -202,7 +202,7 @@ RSpec.describe FA do
202
202
  span = { type: :text, text: 'World', options: { position: :bl } }
203
203
  expect(FA::Span.p(span)).to eql(
204
204
  "<span class='fa-layers-text fa-layers-bottom-left' " \
205
- "style='' data-fa-transform=''>World</span>"
205
+ "id='' style='' data-fa-transform=''>World</span>"
206
206
  )
207
207
  end
208
208
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fa_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.31
4
+ version: 0.1.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-28 00:00:00.000000000 Z
11
+ date: 2023-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake