font-ionicons-rails 2.0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +22 -0
- data/README.md +76 -0
- data/Rakefile +12 -0
- data/app/assets/fonts/ionicons.eot +0 -0
- data/app/assets/fonts/ionicons.svg +2230 -0
- data/app/assets/fonts/ionicons.ttf +0 -0
- data/app/assets/fonts/ionicons.woff +0 -0
- data/app/assets/stylesheets/ionicons.css.erb +1493 -0
- data/app/helpers/font_ionicons/rails/icon_helper.rb +53 -0
- data/lib/font-ionicons-rails.rb +2 -0
- data/lib/font-ionicons-rails/engine.rb +6 -0
- data/lib/font-ionicons-rails/version.rb +6 -0
- data/test/dummy/app/assets/stylesheets/sass-import.css.sass +1 -0
- data/test/dummy/app/assets/stylesheets/scss-import.css.scss +1 -0
- data/test/dummy/app/assets/stylesheets/sprockets-require.css +3 -0
- data/test/dummy/app/controllers/pages_controller.rb +2 -0
- data/test/dummy/app/views/pages/icons.html.erb +1 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +19 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +8 -0
- data/test/dummy/config/routes.rb +3 -0
- data/test/dummy/log/test.log +6861 -0
- data/test/font-ionicons_rails_test.rb +67 -0
- data/test/icon_helper_test.rb +54 -0
- data/test/test_helper.rb +7 -0
- metadata +134 -0
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class FontIoniconsRailsTest < ActionDispatch::IntegrationTest
|
4
|
+
teardown { clean_sprockets_cache }
|
5
|
+
|
6
|
+
test 'engine is loaded' do
|
7
|
+
assert_equal ::Rails::Engine, FontIonicons::Rails::Engine.superclass
|
8
|
+
end
|
9
|
+
|
10
|
+
test 'fonts are served' do
|
11
|
+
get '/assets/ionicons.eot'
|
12
|
+
assert_response :success
|
13
|
+
get '/assets/ionicons.woff'
|
14
|
+
assert_response :success
|
15
|
+
get '/assets/ionicons.ttf'
|
16
|
+
assert_response :success
|
17
|
+
get '/assets/ionicons.svg'
|
18
|
+
assert_response :success
|
19
|
+
end
|
20
|
+
|
21
|
+
test 'stylesheets are served' do
|
22
|
+
get '/assets/ionicons.css'
|
23
|
+
assert_ionicons(response)
|
24
|
+
end
|
25
|
+
|
26
|
+
test 'stylesheets contain asset pipeline references to fonts' do
|
27
|
+
get '/assets/ionicons.css'
|
28
|
+
v = FontIonicons::Rails::FI_VERSION
|
29
|
+
assert_match "/assets/ionicons.eot?v=#{v}", response.body
|
30
|
+
assert_match "/assets/ionicons.eot?#iefix&v=#{v}", response.body
|
31
|
+
assert_match "/assets/ionicons.woff?v=#{v}", response.body
|
32
|
+
assert_match "/assets/ionicons.ttf?v=#{v}", response.body
|
33
|
+
assert_match "/assets/ionicons.svg?v=#{v}#ioniconsregular", response.body
|
34
|
+
end
|
35
|
+
|
36
|
+
test 'stylesheet is available in a css sprockets require' do
|
37
|
+
get '/assets/sprockets-require.css'
|
38
|
+
assert_ionicons(response)
|
39
|
+
end
|
40
|
+
|
41
|
+
test 'stylesheet is available in a sass import' do
|
42
|
+
get '/assets/sass-import.css'
|
43
|
+
assert_ionicons(response)
|
44
|
+
end
|
45
|
+
|
46
|
+
test 'stylesheet is available in a scss import' do
|
47
|
+
get '/assets/scss-import.css'
|
48
|
+
assert_ionicons(response)
|
49
|
+
end
|
50
|
+
|
51
|
+
test 'helpers should be available in the view' do
|
52
|
+
get '/icons'
|
53
|
+
assert_response :success
|
54
|
+
assert_select 'i.ion-flag'
|
55
|
+
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
def clean_sprockets_cache
|
60
|
+
FileUtils.rm_rf File.expand_path('../dummy/tmp', __FILE__)
|
61
|
+
end
|
62
|
+
|
63
|
+
def assert_ionicons(response)
|
64
|
+
assert_response :success
|
65
|
+
assert_match(/font-family:\s*'Ionicons';/, response.body)
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class FontIonicons::Rails::IconHelperTest < ActionView::TestCase
|
4
|
+
test '#ion_icon with no args should render a flag icon' do
|
5
|
+
assert_icon i('ion-flag')
|
6
|
+
end
|
7
|
+
|
8
|
+
test '#ion_icon should render different individual icons' do
|
9
|
+
assert_icon i('ion-flag'), 'flag'
|
10
|
+
assert_icon i('ion-camera-retro'), 'camera-retro'
|
11
|
+
assert_icon i('ion-cog'), 'cog'
|
12
|
+
assert_icon i('ion-github'), 'github'
|
13
|
+
end
|
14
|
+
|
15
|
+
test '#ion_icon should incorporate additional class styles' do
|
16
|
+
assert_icon i('ion-flag pull-right'), 'flag', class: 'pull-right'
|
17
|
+
assert_icon i('ion-check pull-right special'), 'check', class: ['pull-right', 'special']
|
18
|
+
end
|
19
|
+
|
20
|
+
test '#ion_icon should incorporate a text suffix' do
|
21
|
+
assert_icon "#{i('ion-camera-retro')} Take a photo", 'camera-retro', text: 'Take a photo'
|
22
|
+
end
|
23
|
+
|
24
|
+
test '#ion_icon should be able to put the icon on the right' do
|
25
|
+
assert_icon "Submit #{i('ion-chevron-right')}", 'chevron-right', text: 'Submit', right: true
|
26
|
+
end
|
27
|
+
|
28
|
+
test '#ion_icon should html escape text' do
|
29
|
+
assert_icon "#{i('ion-camera-retro')} <script></script>", 'camera-retro', text: '<script></script>'
|
30
|
+
end
|
31
|
+
|
32
|
+
test '#ion_icon should not html escape safe text' do
|
33
|
+
assert_icon "#{i('ion-camera-retro')} <script></script>", 'camera-retro', text: '<script></script>'.html_safe
|
34
|
+
end
|
35
|
+
|
36
|
+
test '#ion_icon should pull it all together' do
|
37
|
+
assert_icon "#{i('ion-camera-retro pull-right')} Take a photo", 'camera-retro', text: 'Take a photo', class: 'pull-right'
|
38
|
+
end
|
39
|
+
|
40
|
+
test '#ion_icon should pass all other options through' do
|
41
|
+
assert_icon %(<i class="ion-user" data-id="123"></i>), 'user', data: { id: 123 }
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def assert_icon(expected, *args)
|
47
|
+
message = "`ion_icon(#{args.inspect[1...-1]})` should return `#{expected}`"
|
48
|
+
assert_dom_equal expected, ion_icon(*args), message
|
49
|
+
end
|
50
|
+
|
51
|
+
def i(classes)
|
52
|
+
%(<i class="#{classes}"></i>)
|
53
|
+
end
|
54
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: font-ionicons-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ricardo Emerson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-06-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: railties
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.2'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5.0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.2'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5.0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: activesupport
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: sass-rails
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
description: The premium icon font for Ionic Framework.
|
62
|
+
email:
|
63
|
+
- ricardo_emerson@yahoo.com.br
|
64
|
+
executables: []
|
65
|
+
extensions: []
|
66
|
+
extra_rdoc_files: []
|
67
|
+
files:
|
68
|
+
- LICENSE
|
69
|
+
- README.md
|
70
|
+
- Rakefile
|
71
|
+
- app/assets/fonts/ionicons.eot
|
72
|
+
- app/assets/fonts/ionicons.svg
|
73
|
+
- app/assets/fonts/ionicons.ttf
|
74
|
+
- app/assets/fonts/ionicons.woff
|
75
|
+
- app/assets/stylesheets/ionicons.css.erb
|
76
|
+
- app/helpers/font_ionicons/rails/icon_helper.rb
|
77
|
+
- lib/font-ionicons-rails.rb
|
78
|
+
- lib/font-ionicons-rails/engine.rb
|
79
|
+
- lib/font-ionicons-rails/version.rb
|
80
|
+
- test/dummy/app/assets/stylesheets/sass-import.css.sass
|
81
|
+
- test/dummy/app/assets/stylesheets/scss-import.css.scss
|
82
|
+
- test/dummy/app/assets/stylesheets/sprockets-require.css
|
83
|
+
- test/dummy/app/controllers/pages_controller.rb
|
84
|
+
- test/dummy/app/views/pages/icons.html.erb
|
85
|
+
- test/dummy/config.ru
|
86
|
+
- test/dummy/config/application.rb
|
87
|
+
- test/dummy/config/boot.rb
|
88
|
+
- test/dummy/config/environment.rb
|
89
|
+
- test/dummy/config/initializers/secret_token.rb
|
90
|
+
- test/dummy/config/routes.rb
|
91
|
+
- test/dummy/log/test.log
|
92
|
+
- test/font-ionicons_rails_test.rb
|
93
|
+
- test/icon_helper_test.rb
|
94
|
+
- test/test_helper.rb
|
95
|
+
homepage: https://github.com/ricardoemerson/font-ionicons-rails
|
96
|
+
licenses:
|
97
|
+
- MIT
|
98
|
+
metadata: {}
|
99
|
+
post_install_message:
|
100
|
+
rdoc_options: []
|
101
|
+
require_paths:
|
102
|
+
- lib
|
103
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: 1.9.3
|
108
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
requirements: []
|
114
|
+
rubyforge_project:
|
115
|
+
rubygems_version: 2.4.5
|
116
|
+
signing_key:
|
117
|
+
specification_version: 4
|
118
|
+
summary: an asset gemification of the ionicons icon font library
|
119
|
+
test_files:
|
120
|
+
- test/dummy/app/assets/stylesheets/sass-import.css.sass
|
121
|
+
- test/dummy/app/assets/stylesheets/scss-import.css.scss
|
122
|
+
- test/dummy/app/assets/stylesheets/sprockets-require.css
|
123
|
+
- test/dummy/app/controllers/pages_controller.rb
|
124
|
+
- test/dummy/app/views/pages/icons.html.erb
|
125
|
+
- test/dummy/config/application.rb
|
126
|
+
- test/dummy/config/boot.rb
|
127
|
+
- test/dummy/config/environment.rb
|
128
|
+
- test/dummy/config/initializers/secret_token.rb
|
129
|
+
- test/dummy/config/routes.rb
|
130
|
+
- test/dummy/config.ru
|
131
|
+
- test/dummy/log/test.log
|
132
|
+
- test/font-ionicons_rails_test.rb
|
133
|
+
- test/icon_helper_test.rb
|
134
|
+
- test/test_helper.rb
|