input_css 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 96311911e15d4e43b1ba057f6e4354f74916f649e59c2bae1f69c5d67ea4d636
4
+ data.tar.gz: b5bc9fcd597b7fc30a6592a9985f9d46845815af1f07ad23cb59c657a73e057e
5
+ SHA512:
6
+ metadata.gz: 3b4263ad645f1833f1e5d6ca1619056e8d6063a1a7ad577a83a181589e661474348add12c94db2a6284fc7864b942f86068eb4005e44ec6aa9e2e54676db3b0c
7
+ data.tar.gz: d3574f0d75471d7ecd8acd8da93b89f2cee092ceaab6d112cc4e41c3eaa135c32ba2b1a7039b9ab688584c4469144e98f4a332dfc9361cfc885f008420208b78
data/.gitignore CHANGED
@@ -2,3 +2,5 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
+ .ruby-version
6
+ .ruby-gemset
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Appraisals ADDED
@@ -0,0 +1,12 @@
1
+ appraise "rails-6.0" do
2
+ gem "rails", "~>6.0.0"
3
+ end
4
+
5
+ appraise "rails-6.1" do
6
+ gem "rails", "~>6.1.0"
7
+ end
8
+
9
+ appraise "rails-7.0" do
10
+ gem "rails", "~>7.0.0"
11
+ end
12
+
data/Gemfile CHANGED
@@ -2,3 +2,5 @@ source "http://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in input_css.gemspec
4
4
  gemspec
5
+
6
+ gem "rails", "~>6.1.0"
data/Rakefile CHANGED
@@ -1 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new
5
+
6
+ task :default => :spec
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "rails", "~>6.0.0"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,165 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ input_css (0.2.0)
5
+ rails
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ actioncable (6.0.5)
11
+ actionpack (= 6.0.5)
12
+ nio4r (~> 2.0)
13
+ websocket-driver (>= 0.6.1)
14
+ actionmailbox (6.0.5)
15
+ actionpack (= 6.0.5)
16
+ activejob (= 6.0.5)
17
+ activerecord (= 6.0.5)
18
+ activestorage (= 6.0.5)
19
+ activesupport (= 6.0.5)
20
+ mail (>= 2.7.1)
21
+ actionmailer (6.0.5)
22
+ actionpack (= 6.0.5)
23
+ actionview (= 6.0.5)
24
+ activejob (= 6.0.5)
25
+ mail (~> 2.5, >= 2.5.4)
26
+ rails-dom-testing (~> 2.0)
27
+ actionpack (6.0.5)
28
+ actionview (= 6.0.5)
29
+ activesupport (= 6.0.5)
30
+ rack (~> 2.0, >= 2.0.8)
31
+ rack-test (>= 0.6.3)
32
+ rails-dom-testing (~> 2.0)
33
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
34
+ actiontext (6.0.5)
35
+ actionpack (= 6.0.5)
36
+ activerecord (= 6.0.5)
37
+ activestorage (= 6.0.5)
38
+ activesupport (= 6.0.5)
39
+ nokogiri (>= 1.8.5)
40
+ actionview (6.0.5)
41
+ activesupport (= 6.0.5)
42
+ builder (~> 3.1)
43
+ erubi (~> 1.4)
44
+ rails-dom-testing (~> 2.0)
45
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
46
+ activejob (6.0.5)
47
+ activesupport (= 6.0.5)
48
+ globalid (>= 0.3.6)
49
+ activemodel (6.0.5)
50
+ activesupport (= 6.0.5)
51
+ activerecord (6.0.5)
52
+ activemodel (= 6.0.5)
53
+ activesupport (= 6.0.5)
54
+ activestorage (6.0.5)
55
+ actionpack (= 6.0.5)
56
+ activejob (= 6.0.5)
57
+ activerecord (= 6.0.5)
58
+ marcel (~> 1.0)
59
+ activesupport (6.0.5)
60
+ concurrent-ruby (~> 1.0, >= 1.0.2)
61
+ i18n (>= 0.7, < 2)
62
+ minitest (~> 5.1)
63
+ tzinfo (~> 1.1)
64
+ zeitwerk (~> 2.2, >= 2.2.2)
65
+ appraisal (2.4.1)
66
+ bundler
67
+ rake
68
+ thor (>= 0.14.0)
69
+ builder (3.2.4)
70
+ concurrent-ruby (1.1.10)
71
+ crass (1.0.6)
72
+ diff-lcs (1.5.0)
73
+ equivalent-xml (0.6.0)
74
+ nokogiri (>= 1.4.3)
75
+ erubi (1.10.0)
76
+ globalid (1.0.0)
77
+ activesupport (>= 5.0)
78
+ i18n (1.10.0)
79
+ concurrent-ruby (~> 1.0)
80
+ loofah (2.18.0)
81
+ crass (~> 1.0.2)
82
+ nokogiri (>= 1.5.9)
83
+ mail (2.7.1)
84
+ mini_mime (>= 0.1.1)
85
+ marcel (1.0.2)
86
+ method_source (1.0.0)
87
+ mini_mime (1.1.2)
88
+ mini_portile2 (2.8.0)
89
+ minitest (5.15.0)
90
+ nio4r (2.5.8)
91
+ nokogiri (1.13.6)
92
+ mini_portile2 (~> 2.8.0)
93
+ racc (~> 1.4)
94
+ racc (1.6.0)
95
+ rack (2.2.3.1)
96
+ rack-test (1.1.0)
97
+ rack (>= 1.0, < 3)
98
+ rails (6.0.5)
99
+ actioncable (= 6.0.5)
100
+ actionmailbox (= 6.0.5)
101
+ actionmailer (= 6.0.5)
102
+ actionpack (= 6.0.5)
103
+ actiontext (= 6.0.5)
104
+ actionview (= 6.0.5)
105
+ activejob (= 6.0.5)
106
+ activemodel (= 6.0.5)
107
+ activerecord (= 6.0.5)
108
+ activestorage (= 6.0.5)
109
+ activesupport (= 6.0.5)
110
+ bundler (>= 1.3.0)
111
+ railties (= 6.0.5)
112
+ sprockets-rails (>= 2.0.0)
113
+ rails-dom-testing (2.0.3)
114
+ activesupport (>= 4.2.0)
115
+ nokogiri (>= 1.6)
116
+ rails-html-sanitizer (1.4.3)
117
+ loofah (~> 2.3)
118
+ railties (6.0.5)
119
+ actionpack (= 6.0.5)
120
+ activesupport (= 6.0.5)
121
+ method_source
122
+ rake (>= 0.8.7)
123
+ thor (>= 0.20.3, < 2.0)
124
+ rake (13.0.6)
125
+ rspec (3.11.0)
126
+ rspec-core (~> 3.11.0)
127
+ rspec-expectations (~> 3.11.0)
128
+ rspec-mocks (~> 3.11.0)
129
+ rspec-core (3.11.0)
130
+ rspec-support (~> 3.11.0)
131
+ rspec-expectations (3.11.0)
132
+ diff-lcs (>= 1.2.0, < 2.0)
133
+ rspec-support (~> 3.11.0)
134
+ rspec-mocks (3.11.1)
135
+ diff-lcs (>= 1.2.0, < 2.0)
136
+ rspec-support (~> 3.11.0)
137
+ rspec-support (3.11.0)
138
+ sprockets (4.0.3)
139
+ concurrent-ruby (~> 1.0)
140
+ rack (> 1, < 3)
141
+ sprockets-rails (3.4.2)
142
+ actionpack (>= 5.2)
143
+ activesupport (>= 5.2)
144
+ sprockets (>= 3.0.0)
145
+ thor (1.2.1)
146
+ thread_safe (0.3.6)
147
+ tzinfo (1.2.9)
148
+ thread_safe (~> 0.1)
149
+ websocket-driver (0.7.5)
150
+ websocket-extensions (>= 0.1.0)
151
+ websocket-extensions (0.1.5)
152
+ zeitwerk (2.5.4)
153
+
154
+ PLATFORMS
155
+ ruby
156
+
157
+ DEPENDENCIES
158
+ appraisal
159
+ equivalent-xml
160
+ input_css!
161
+ rails (~> 6.0.0)
162
+ rspec
163
+
164
+ BUNDLED WITH
165
+ 2.1.4
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "rails", "~>6.1.0"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,168 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ input_css (0.2.0)
5
+ rails
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ actioncable (6.1.6)
11
+ actionpack (= 6.1.6)
12
+ activesupport (= 6.1.6)
13
+ nio4r (~> 2.0)
14
+ websocket-driver (>= 0.6.1)
15
+ actionmailbox (6.1.6)
16
+ actionpack (= 6.1.6)
17
+ activejob (= 6.1.6)
18
+ activerecord (= 6.1.6)
19
+ activestorage (= 6.1.6)
20
+ activesupport (= 6.1.6)
21
+ mail (>= 2.7.1)
22
+ actionmailer (6.1.6)
23
+ actionpack (= 6.1.6)
24
+ actionview (= 6.1.6)
25
+ activejob (= 6.1.6)
26
+ activesupport (= 6.1.6)
27
+ mail (~> 2.5, >= 2.5.4)
28
+ rails-dom-testing (~> 2.0)
29
+ actionpack (6.1.6)
30
+ actionview (= 6.1.6)
31
+ activesupport (= 6.1.6)
32
+ rack (~> 2.0, >= 2.0.9)
33
+ rack-test (>= 0.6.3)
34
+ rails-dom-testing (~> 2.0)
35
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
36
+ actiontext (6.1.6)
37
+ actionpack (= 6.1.6)
38
+ activerecord (= 6.1.6)
39
+ activestorage (= 6.1.6)
40
+ activesupport (= 6.1.6)
41
+ nokogiri (>= 1.8.5)
42
+ actionview (6.1.6)
43
+ activesupport (= 6.1.6)
44
+ builder (~> 3.1)
45
+ erubi (~> 1.4)
46
+ rails-dom-testing (~> 2.0)
47
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
48
+ activejob (6.1.6)
49
+ activesupport (= 6.1.6)
50
+ globalid (>= 0.3.6)
51
+ activemodel (6.1.6)
52
+ activesupport (= 6.1.6)
53
+ activerecord (6.1.6)
54
+ activemodel (= 6.1.6)
55
+ activesupport (= 6.1.6)
56
+ activestorage (6.1.6)
57
+ actionpack (= 6.1.6)
58
+ activejob (= 6.1.6)
59
+ activerecord (= 6.1.6)
60
+ activesupport (= 6.1.6)
61
+ marcel (~> 1.0)
62
+ mini_mime (>= 1.1.0)
63
+ activesupport (6.1.6)
64
+ concurrent-ruby (~> 1.0, >= 1.0.2)
65
+ i18n (>= 1.6, < 2)
66
+ minitest (>= 5.1)
67
+ tzinfo (~> 2.0)
68
+ zeitwerk (~> 2.3)
69
+ appraisal (2.4.1)
70
+ bundler
71
+ rake
72
+ thor (>= 0.14.0)
73
+ builder (3.2.4)
74
+ concurrent-ruby (1.1.10)
75
+ crass (1.0.6)
76
+ diff-lcs (1.5.0)
77
+ equivalent-xml (0.6.0)
78
+ nokogiri (>= 1.4.3)
79
+ erubi (1.10.0)
80
+ globalid (1.0.0)
81
+ activesupport (>= 5.0)
82
+ i18n (1.10.0)
83
+ concurrent-ruby (~> 1.0)
84
+ loofah (2.18.0)
85
+ crass (~> 1.0.2)
86
+ nokogiri (>= 1.5.9)
87
+ mail (2.7.1)
88
+ mini_mime (>= 0.1.1)
89
+ marcel (1.0.2)
90
+ method_source (1.0.0)
91
+ mini_mime (1.1.2)
92
+ mini_portile2 (2.8.0)
93
+ minitest (5.15.0)
94
+ nio4r (2.5.8)
95
+ nokogiri (1.13.6)
96
+ mini_portile2 (~> 2.8.0)
97
+ racc (~> 1.4)
98
+ racc (1.6.0)
99
+ rack (2.2.3.1)
100
+ rack-test (1.1.0)
101
+ rack (>= 1.0, < 3)
102
+ rails (6.1.6)
103
+ actioncable (= 6.1.6)
104
+ actionmailbox (= 6.1.6)
105
+ actionmailer (= 6.1.6)
106
+ actionpack (= 6.1.6)
107
+ actiontext (= 6.1.6)
108
+ actionview (= 6.1.6)
109
+ activejob (= 6.1.6)
110
+ activemodel (= 6.1.6)
111
+ activerecord (= 6.1.6)
112
+ activestorage (= 6.1.6)
113
+ activesupport (= 6.1.6)
114
+ bundler (>= 1.15.0)
115
+ railties (= 6.1.6)
116
+ sprockets-rails (>= 2.0.0)
117
+ rails-dom-testing (2.0.3)
118
+ activesupport (>= 4.2.0)
119
+ nokogiri (>= 1.6)
120
+ rails-html-sanitizer (1.4.3)
121
+ loofah (~> 2.3)
122
+ railties (6.1.6)
123
+ actionpack (= 6.1.6)
124
+ activesupport (= 6.1.6)
125
+ method_source
126
+ rake (>= 12.2)
127
+ thor (~> 1.0)
128
+ rake (13.0.6)
129
+ rspec (3.11.0)
130
+ rspec-core (~> 3.11.0)
131
+ rspec-expectations (~> 3.11.0)
132
+ rspec-mocks (~> 3.11.0)
133
+ rspec-core (3.11.0)
134
+ rspec-support (~> 3.11.0)
135
+ rspec-expectations (3.11.0)
136
+ diff-lcs (>= 1.2.0, < 2.0)
137
+ rspec-support (~> 3.11.0)
138
+ rspec-mocks (3.11.1)
139
+ diff-lcs (>= 1.2.0, < 2.0)
140
+ rspec-support (~> 3.11.0)
141
+ rspec-support (3.11.0)
142
+ sprockets (4.0.3)
143
+ concurrent-ruby (~> 1.0)
144
+ rack (> 1, < 3)
145
+ sprockets-rails (3.4.2)
146
+ actionpack (>= 5.2)
147
+ activesupport (>= 5.2)
148
+ sprockets (>= 3.0.0)
149
+ thor (1.2.1)
150
+ tzinfo (2.0.4)
151
+ concurrent-ruby (~> 1.0)
152
+ websocket-driver (0.7.5)
153
+ websocket-extensions (>= 0.1.0)
154
+ websocket-extensions (0.1.5)
155
+ zeitwerk (2.5.4)
156
+
157
+ PLATFORMS
158
+ ruby
159
+
160
+ DEPENDENCIES
161
+ appraisal
162
+ equivalent-xml
163
+ input_css!
164
+ rails (~> 6.1.0)
165
+ rspec
166
+
167
+ BUNDLED WITH
168
+ 2.1.4
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "rails", "~>7.0.0"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,182 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ input_css (0.2.0)
5
+ rails
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ actioncable (7.0.3)
11
+ actionpack (= 7.0.3)
12
+ activesupport (= 7.0.3)
13
+ nio4r (~> 2.0)
14
+ websocket-driver (>= 0.6.1)
15
+ actionmailbox (7.0.3)
16
+ actionpack (= 7.0.3)
17
+ activejob (= 7.0.3)
18
+ activerecord (= 7.0.3)
19
+ activestorage (= 7.0.3)
20
+ activesupport (= 7.0.3)
21
+ mail (>= 2.7.1)
22
+ net-imap
23
+ net-pop
24
+ net-smtp
25
+ actionmailer (7.0.3)
26
+ actionpack (= 7.0.3)
27
+ actionview (= 7.0.3)
28
+ activejob (= 7.0.3)
29
+ activesupport (= 7.0.3)
30
+ mail (~> 2.5, >= 2.5.4)
31
+ net-imap
32
+ net-pop
33
+ net-smtp
34
+ rails-dom-testing (~> 2.0)
35
+ actionpack (7.0.3)
36
+ actionview (= 7.0.3)
37
+ activesupport (= 7.0.3)
38
+ rack (~> 2.0, >= 2.2.0)
39
+ rack-test (>= 0.6.3)
40
+ rails-dom-testing (~> 2.0)
41
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
42
+ actiontext (7.0.3)
43
+ actionpack (= 7.0.3)
44
+ activerecord (= 7.0.3)
45
+ activestorage (= 7.0.3)
46
+ activesupport (= 7.0.3)
47
+ globalid (>= 0.6.0)
48
+ nokogiri (>= 1.8.5)
49
+ actionview (7.0.3)
50
+ activesupport (= 7.0.3)
51
+ builder (~> 3.1)
52
+ erubi (~> 1.4)
53
+ rails-dom-testing (~> 2.0)
54
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
55
+ activejob (7.0.3)
56
+ activesupport (= 7.0.3)
57
+ globalid (>= 0.3.6)
58
+ activemodel (7.0.3)
59
+ activesupport (= 7.0.3)
60
+ activerecord (7.0.3)
61
+ activemodel (= 7.0.3)
62
+ activesupport (= 7.0.3)
63
+ activestorage (7.0.3)
64
+ actionpack (= 7.0.3)
65
+ activejob (= 7.0.3)
66
+ activerecord (= 7.0.3)
67
+ activesupport (= 7.0.3)
68
+ marcel (~> 1.0)
69
+ mini_mime (>= 1.1.0)
70
+ activesupport (7.0.3)
71
+ concurrent-ruby (~> 1.0, >= 1.0.2)
72
+ i18n (>= 1.6, < 2)
73
+ minitest (>= 5.1)
74
+ tzinfo (~> 2.0)
75
+ appraisal (2.4.1)
76
+ bundler
77
+ rake
78
+ thor (>= 0.14.0)
79
+ builder (3.2.4)
80
+ concurrent-ruby (1.1.10)
81
+ crass (1.0.6)
82
+ diff-lcs (1.5.0)
83
+ digest (3.1.0)
84
+ equivalent-xml (0.6.0)
85
+ nokogiri (>= 1.4.3)
86
+ erubi (1.10.0)
87
+ globalid (1.0.0)
88
+ activesupport (>= 5.0)
89
+ i18n (1.10.0)
90
+ concurrent-ruby (~> 1.0)
91
+ loofah (2.18.0)
92
+ crass (~> 1.0.2)
93
+ nokogiri (>= 1.5.9)
94
+ mail (2.7.1)
95
+ mini_mime (>= 0.1.1)
96
+ marcel (1.0.2)
97
+ method_source (1.0.0)
98
+ mini_mime (1.1.2)
99
+ minitest (5.15.0)
100
+ net-imap (0.2.3)
101
+ digest
102
+ net-protocol
103
+ strscan
104
+ net-pop (0.1.1)
105
+ digest
106
+ net-protocol
107
+ timeout
108
+ net-protocol (0.1.3)
109
+ timeout
110
+ net-smtp (0.3.1)
111
+ digest
112
+ net-protocol
113
+ timeout
114
+ nio4r (2.5.8)
115
+ nokogiri (1.13.6-x86_64-linux)
116
+ racc (~> 1.4)
117
+ racc (1.6.0)
118
+ rack (2.2.3.1)
119
+ rack-test (1.1.0)
120
+ rack (>= 1.0, < 3)
121
+ rails (7.0.3)
122
+ actioncable (= 7.0.3)
123
+ actionmailbox (= 7.0.3)
124
+ actionmailer (= 7.0.3)
125
+ actionpack (= 7.0.3)
126
+ actiontext (= 7.0.3)
127
+ actionview (= 7.0.3)
128
+ activejob (= 7.0.3)
129
+ activemodel (= 7.0.3)
130
+ activerecord (= 7.0.3)
131
+ activestorage (= 7.0.3)
132
+ activesupport (= 7.0.3)
133
+ bundler (>= 1.15.0)
134
+ railties (= 7.0.3)
135
+ rails-dom-testing (2.0.3)
136
+ activesupport (>= 4.2.0)
137
+ nokogiri (>= 1.6)
138
+ rails-html-sanitizer (1.4.3)
139
+ loofah (~> 2.3)
140
+ railties (7.0.3)
141
+ actionpack (= 7.0.3)
142
+ activesupport (= 7.0.3)
143
+ method_source
144
+ rake (>= 12.2)
145
+ thor (~> 1.0)
146
+ zeitwerk (~> 2.5)
147
+ rake (13.0.6)
148
+ rspec (3.11.0)
149
+ rspec-core (~> 3.11.0)
150
+ rspec-expectations (~> 3.11.0)
151
+ rspec-mocks (~> 3.11.0)
152
+ rspec-core (3.11.0)
153
+ rspec-support (~> 3.11.0)
154
+ rspec-expectations (3.11.0)
155
+ diff-lcs (>= 1.2.0, < 2.0)
156
+ rspec-support (~> 3.11.0)
157
+ rspec-mocks (3.11.1)
158
+ diff-lcs (>= 1.2.0, < 2.0)
159
+ rspec-support (~> 3.11.0)
160
+ rspec-support (3.11.0)
161
+ strscan (3.0.3)
162
+ thor (1.2.1)
163
+ timeout (0.3.0)
164
+ tzinfo (2.0.4)
165
+ concurrent-ruby (~> 1.0)
166
+ websocket-driver (0.7.5)
167
+ websocket-extensions (>= 0.1.0)
168
+ websocket-extensions (0.1.5)
169
+ zeitwerk (2.5.4)
170
+
171
+ PLATFORMS
172
+ ruby
173
+
174
+ DEPENDENCIES
175
+ appraisal
176
+ equivalent-xml
177
+ input_css!
178
+ rails (~> 7.0.0)
179
+ rspec
180
+
181
+ BUNDLED WITH
182
+ 2.1.4
data/input_css.gemspec CHANGED
@@ -19,4 +19,8 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
  s.add_runtime_dependency "rails"
22
+
23
+ s.add_development_dependency "rspec"
24
+ s.add_development_dependency "equivalent-xml"
25
+ s.add_development_dependency "appraisal"
22
26
  end
@@ -1,3 +1,3 @@
1
1
  module InputCSS
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/input_css.rb CHANGED
@@ -3,35 +3,46 @@ require "input_css/version"
3
3
  # Modifies the 'options' of the tag helper so that, by default,
4
4
  # there's a CSS class attribute based on the type attribute
5
5
  # (Note: only applies to input fields)
6
+ module InputCSS
7
+ def tag(name=nil, options=nil, open=false, escape=true)
8
+ if name.present?
9
+ options = css_options_for_tag(name, options)
10
+ end
11
+ super
12
+ end
13
+
14
+ def css_options_for_tag(name, options)
15
+ options = HashWithIndifferentAccess.new(options)
16
+ return options if options[:type] == 'hidden'
17
+
18
+ # alter CSS class based on type
19
+ # (only for <input ... /> tags)
20
+ if name.to_s.downcase =~ /^input$/
21
+ type, css = options[:type], options[:class]
22
+ type = 'text' if type == 'password'
23
+ options[:class] = "#{css.to_s} #{type.to_s}".gsub!(/^\s*/, '') unless css && css.split.include?(type)
24
+ end
25
+ options
26
+ end
27
+ module_function :css_options_for_tag
28
+ end
29
+
6
30
  module ActionView
7
31
  module Helpers
8
32
  module TagHelper
9
- def tag_with_default_css(name, options=nil, open=false, escape=true)
10
- options = css_options_for_tag(name, options)
11
- tag_without_default_css(name, options, open, escape)
12
- end
13
- alias_method_chain :tag, :default_css
14
-
15
- private
16
-
17
- def css_options_for_tag(name, options)
18
- options = HashWithIndifferentAccess.new(options)
19
- return options if options[:type] == 'hidden'
20
-
21
- # alter CSS class based on type
22
- # (only for <input ... /> tags)
23
- if name.to_s.downcase =~ /^input$/
24
- type, css = options[:type], options[:class]
25
- type = 'text' if type == 'password'
26
- options[:class] = "#{css.to_s} #{type.to_s}".gsub!(/^\s*/, '') unless css && css.split.include?(type)
33
+ if respond_to?(:prepend) # Rails 5 compat
34
+ prepend InputCSS
35
+ else
36
+ def tag_with_default_css(name, options=nil, open=false, escape=true)
37
+ options = InputCSS.css_options_for_tag(name, options)
38
+ tag_without_default_css(name, options, open, escape)
27
39
  end
28
- options
40
+ alias_method_chain :tag, :default_css
29
41
  end
30
42
  end
31
43
 
32
44
  class InstanceTag
33
45
  alias_method :tag_without_error_wrapping, :tag_with_default_css
34
- options
35
46
  end if defined?(InstanceTag) # Rails 3 compat
36
47
  end
37
48
  end
@@ -11,18 +11,18 @@ describe "InputCSS" do
11
11
  VALID_TYPES.each do |type|
12
12
  it "should have class='#{type}' for type='#{type}'" do
13
13
  tag('input', { :type => type }).
14
- should eql("<input class=\"#{type}\" type=\"#{type}\" />")
14
+ should be_equivalent_to("<input class=\"#{type}\" type=\"#{type}\" />")
15
15
  end
16
16
  end
17
17
 
18
18
  it "should have class='text' for type='password'" do
19
19
  tag('input', { :type => 'password' }).
20
- should eql("<input class=\"text\" type=\"password\" />")
20
+ should be_equivalent_to("<input class=\"text\" type=\"password\" />")
21
21
  end
22
22
 
23
23
  it "should not have a class attribute for type='hidden'" do
24
24
  tag('input', {:type => 'hidden'}).
25
- should eql("<input type=\"hidden\" />")
25
+ should be_equivalent_to("<input type=\"hidden\" />")
26
26
  end
27
27
  end
28
28
 
@@ -32,12 +32,15 @@ describe "InputCSS" do
32
32
 
33
33
  describe "use examples shown in TagHelper#tag documentation" do
34
34
  it "should not add a default class attribute to non-INPUT tags" do
35
- tag('br').should eql("<br />")
36
- tag('br', nil, true).should eql("<br>")
35
+ tag('br').should be_equivalent_to("<br />")
36
+ tag.br.should be_equivalent_to("<br />")
37
+
37
38
  tag('img', {:src => 'open & shut.png'}).
38
- should eql("<img src=\"open &amp; shut.png\" />")
39
+ should be_equivalent_to("<img src=\"open &amp; shut.png\" />")
39
40
  tag('img', {:src => 'open &amp; shut.png'}, false, false).
40
- should eql("<img src=\"open &amp; shut.png\" />")
41
+ should be_equivalent_to("<img src=\"open &amp; shut.png\" />")
42
+ tag.img(src: 'open & shut.png').
43
+ should be_equivalent_to("<img src=\"open &amp; shut.png\" />")
41
44
  end
42
45
  end
43
46
 
@@ -47,19 +50,19 @@ describe "InputCSS" do
47
50
 
48
51
  it "should behave as expected (according to documentation) with the addition of default class" do
49
52
  text_field_tag('name').
50
- should eql("<input class=\"text\" id=\"name\" name=\"name\" type=\"text\" />")
53
+ should be_equivalent_to("<input class=\"text\" id=\"name\" name=\"name\" type=\"text\" />")
51
54
  text_field_tag('query', 'Enter your search query here').
52
- should eql("<input class=\"text\" id=\"query\" name=\"query\" type=\"text\" value=\"Enter your search query here\" />")
55
+ should be_equivalent_to("<input class=\"text\" id=\"query\" name=\"query\" type=\"text\" value=\"Enter your search query here\" />")
53
56
  text_field_tag('request', nil, :class => 'special_input').
54
- should eql("<input class=\"special_input text\" id=\"request\" name=\"request\" type=\"text\" />")
57
+ should be_equivalent_to("<input class=\"special_input text\" id=\"request\" name=\"request\" type=\"text\" />")
55
58
  text_field_tag('address', '', :size => 75).
56
- should eql("<input class=\"text\" id=\"address\" name=\"address\" size=\"75\" type=\"text\" value=\"\" />")
59
+ should be_equivalent_to("<input class=\"text\" id=\"address\" name=\"address\" size=\"75\" type=\"text\" value=\"\" />")
57
60
  text_field_tag('zip', nil, :maxlength => 5).
58
- should eql("<input class=\"text\" id=\"zip\" maxlength=\"5\" name=\"zip\" type=\"text\" />")
61
+ should be_equivalent_to("<input class=\"text\" id=\"zip\" maxlength=\"5\" name=\"zip\" type=\"text\" />")
59
62
  text_field_tag('payment_amount', '$0.00', :disabled => true).
60
- should eql("<input class=\"text\" disabled=\"disabled\" id=\"payment_amount\" name=\"payment_amount\" type=\"text\" value=\"$0.00\" />")
63
+ should be_equivalent_to("<input class=\"text\" disabled=\"disabled\" id=\"payment_amount\" name=\"payment_amount\" type=\"text\" value=\"$0.00\" />")
61
64
  text_field_tag('ip', '0.0.0.0', :maxlength => 15, :size => 20, :class => 'ip-input').
62
- should eql("<input class=\"ip-input text\" id=\"ip\" maxlength=\"15\" name=\"ip\" size=\"20\" type=\"text\" value=\"0.0.0.0\" />")
65
+ should be_equivalent_to("<input class=\"ip-input text\" id=\"ip\" maxlength=\"15\" name=\"ip\" size=\"20\" type=\"text\" value=\"0.0.0.0\" />")
63
66
  end
64
67
  end
65
68
 
@@ -80,64 +83,64 @@ describe "InputCSS" do
80
83
  # FormHelper#text_field
81
84
  it "should add default css to text_field" do
82
85
  text_field(:project, :title, :object => @project).
83
- should eql("<input class=\"text\" id=\"project_title\" name=\"project[title]\" size=\"30\" type=\"text\" value=\"RPH\" />")
86
+ should be_equivalent_to("<input class=\"text\" id=\"project_title\" name=\"project[title]\" type=\"text\" value=\"RPH\" />")
84
87
  end
85
88
 
86
89
  it "should append css to existing css" do
87
90
  text_field(:project, :title, :object => @project, :class => 'project').
88
- should eql("<input class=\"project text\" id=\"project_title\" name=\"project[title]\" size=\"30\" type=\"text\" value=\"RPH\" />")
91
+ should be_equivalent_to("<input class=\"project text\" id=\"project_title\" name=\"project[title]\" type=\"text\" value=\"RPH\" />")
89
92
  end
90
93
 
91
94
  # FormHelper#hidden_field
92
95
  it "should not add css to hidden_field" do
93
96
  hidden_field(:project, :title, :object => @project).
94
- should eql("<input id=\"project_title\" name=\"project[title]\" type=\"hidden\" value=\"RPH\" />")
97
+ should be_equivalent_to("<input id=\"project_title\" name=\"project[title]\" type=\"hidden\" value=\"RPH\" #{autocomplete}/>")
95
98
  end
96
99
 
97
100
  # FormHelper#password_field
98
101
  it "should add default css of 'text' to password_field" do
99
102
  password_field(:project, :title, :object => @project).
100
- should eql("<input class=\"text\" id=\"project_title\" name=\"project[title]\" size=\"30\" type=\"password\" value=\"RPH\" />")
103
+ should be_equivalent_to("<input class=\"text\" id=\"project_title\" name=\"project[title]\" type=\"password\" />")
101
104
  end
102
105
 
103
106
  it "should add default css of 'text' to password_field" do
104
107
  password_field(:project, :title, :object => @project, :class => 'project').
105
- should eql("<input class=\"project text\" id=\"project_title\" name=\"project[title]\" size=\"30\" type=\"password\" value=\"RPH\" />")
108
+ should be_equivalent_to("<input class=\"project text\" id=\"project_title\" name=\"project[title]\" type=\"password\" />")
106
109
  end
107
110
 
108
111
  # FormHelper#check_box
109
112
  it "should add default css to check_box" do
110
113
  check_box(:project, :is_complete, :object => @project).
111
- should eql(
112
- "<input checked=\"checked\" class=\"checkbox\" id=\"project_is_complete\" name=\"project[is_complete]\" type=\"checkbox\" value=\"1\" />" +
113
- "<input name=\"project[is_complete]\" type=\"hidden\" value=\"0\" />"
114
+ should be_equivalent_to(
115
+ "<input name=\"project[is_complete]\" type=\"hidden\" value=\"0\" #{autocomplete}/>" +
116
+ "<input checked=\"checked\" class=\"checkbox\" id=\"project_is_complete\" name=\"project[is_complete]\" type=\"checkbox\" value=\"1\" />"
114
117
  )
115
118
  end
116
119
 
117
120
  it "should add default css to check_box" do
118
121
  check_box(:project, :is_complete, :object => @project, :class => 'project').
119
- should eql(
122
+ should be_equivalent_to(
120
123
  "<input checked=\"checked\" class=\"project checkbox\" id=\"project_is_complete\" name=\"project[is_complete]\" type=\"checkbox\" value=\"1\" />" +
121
- "<input name=\"project[is_complete]\" type=\"hidden\" value=\"0\" />"
124
+ "<input name=\"project[is_complete]\" type=\"hidden\" value=\"0\" #{autocomplete}/>"
122
125
  )
123
126
  end
124
127
 
125
128
  # FormHelper#radio_button
126
129
  it "should add default css to radio_button" do
127
130
  radio_button(:project, :is_complete, 'yes').
128
- should eql("<input class=\"radio\" id=\"project_is_complete_yes\" name=\"project[is_complete]\" type=\"radio\" value=\"yes\" />")
131
+ should be_equivalent_to("<input class=\"radio\" id=\"project_is_complete_yes\" name=\"project[is_complete]\" type=\"radio\" value=\"yes\" />")
129
132
  end
130
133
 
131
134
  it "should add default css to radio_button" do
132
135
  radio_button(:project, :is_complete, 'yes', :class => 'project').
133
- should eql("<input class=\"project radio\" id=\"project_is_complete_yes\" name=\"project[is_complete]\" type=\"radio\" value=\"yes\" />")
136
+ should be_equivalent_to("<input class=\"project radio\" id=\"project_is_complete_yes\" name=\"project[is_complete]\" type=\"radio\" value=\"yes\" />")
134
137
  end
135
138
 
136
139
  # FormHelper#file_field
137
140
  it "should add default css to file_field" do
138
141
  file_field(:project, :chart).
139
- should eql("<input class=\"file\" id=\"project_chart\" name=\"project[chart]\" size=\"30\" type=\"file\" />")
142
+ should be_equivalent_to("<input class=\"file\" id=\"project_chart\" name=\"project[chart]\" type=\"file\" />")
140
143
  end
141
144
  end
142
145
  end
143
- end
146
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,76 @@
1
- require 'rubygems'
2
1
  require 'action_controller'
3
2
  require 'action_view'
4
- require File.join(File.dirname(__FILE__), "../lib/input_css")
3
+ require_relative "../lib/input_css"
4
+
5
+ require 'rspec/matchers' # req by equivalent-xml custom matcher `be_equivalent_to`
6
+ require 'equivalent-xml'
7
+
8
+ RSpec.configure do |config|
9
+ # These two settings work together to allow you to limit a spec run
10
+ # to individual examples or groups you care about by tagging them with
11
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
12
+ # get run.
13
+ config.filter_run :focus
14
+ config.run_all_when_everything_filtered = true
15
+
16
+ # Many RSpec users commonly either run the entire suite or an individual
17
+ # file, and it's useful to allow more verbose output when running an
18
+ # individual spec file.
19
+ if config.files_to_run.one?
20
+ # Use the documentation formatter for detailed output,
21
+ # unless a formatter has already been configured
22
+ # (e.g. via a command-line flag).
23
+ config.default_formatter = 'doc'
24
+ end
25
+
26
+ # Print the 10 slowest examples and example groups at the
27
+ # end of the spec run, to help surface which specs are running
28
+ # particularly slow.
29
+ # config.profile_examples = 10
30
+
31
+ # Run specs in random order to surface order dependencies. If you find an
32
+ # order dependency and want to debug it, you can fix the order by providing
33
+ # the seed, which is printed after each run.
34
+ # --seed 1234
35
+ config.order = :random
36
+
37
+ # Seed global randomization in this process using the `--seed` CLI option.
38
+ # Setting this allows you to use `--seed` to deterministically reproduce
39
+ # test failures related to randomization by passing the same `--seed` value
40
+ # as the one that triggered the failure.
41
+ Kernel.srand config.seed
42
+
43
+ # rspec-expectations config goes here. You can use an alternate
44
+ # assertion/expectation library such as wrong or the stdlib/minitest
45
+ # assertions if you prefer.
46
+ config.expect_with :rspec do |expectations|
47
+ # Enable only the newer, non-monkey-patching expect syntax.
48
+ # For more details, see:
49
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
50
+ expectations.syntax = [:should, :expect]
51
+ end
52
+
53
+ config.define_derived_metadata do |meta|
54
+ meta[:aggregate_failures] = true unless meta.key?(:aggregate_failures)
55
+ end
56
+
57
+ # rspec-mocks config goes here. You can use an alternate test double
58
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
59
+ config.mock_with :rspec do |mocks|
60
+ # Enable only the newer, non-monkey-patching expect syntax.
61
+ # For more details, see:
62
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
63
+ mocks.syntax = [:should, :expect]
64
+
65
+ # Prevents you from mocking or stubbing a method that does not exist on
66
+ # a real object. This is generally recommended.
67
+ mocks.verify_partial_doubles = true
68
+ end
69
+ end
70
+
71
+ def autocomplete
72
+ if Gem.loaded_specs["rails"].version.to_s >= "6.1"
73
+ 'autocomplete="off"'
74
+ end
75
+ end
76
+
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: input_css
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.1.0
4
+ version: 0.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ryan Heath
@@ -10,22 +9,62 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-06-23 00:00:00.000000000 Z
12
+ date: 2022-06-11 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
- prerelease: false
17
- type: :runtime
18
15
  name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rspec
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :development
36
+ prerelease: false
19
37
  version_requirements: !ruby/object:Gem::Requirement
20
- none: false
21
38
  requirements:
22
- - - ! '>='
39
+ - - ">="
23
40
  - !ruby/object:Gem::Version
24
41
  version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: equivalent-xml
25
44
  requirement: !ruby/object:Gem::Requirement
26
- none: false
27
45
  requirements:
28
- - - ! '>='
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: appraisal
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
29
68
  - !ruby/object:Gem::Version
30
69
  version: '0'
31
70
  description: This plugin taps into Rails tag helpers and adds a CSS class equal to
@@ -37,44 +76,45 @@ executables: []
37
76
  extensions: []
38
77
  extra_rdoc_files: []
39
78
  files:
40
- - .gitignore
79
+ - ".gitignore"
80
+ - ".rspec"
81
+ - Appraisals
41
82
  - Gemfile
42
83
  - MIT-LICENSE
43
84
  - README.textile
44
85
  - Rakefile
45
- - init.rb
86
+ - gemfiles/rails_6.0.gemfile
87
+ - gemfiles/rails_6.0.gemfile.lock
88
+ - gemfiles/rails_6.1.gemfile
89
+ - gemfiles/rails_6.1.gemfile.lock
90
+ - gemfiles/rails_7.0.gemfile
91
+ - gemfiles/rails_7.0.gemfile.lock
46
92
  - input_css.gemspec
47
- - install.rb
48
93
  - lib/input_css.rb
49
94
  - lib/input_css/version.rb
50
95
  - spec/input_css_spec.rb
51
- - spec/rcov.opts
52
- - spec/spec.opts
53
96
  - spec/spec_helper.rb
54
97
  - tasks/input_css_tasks.rake
55
- - uninstall.rb
56
98
  homepage: https://github.com/botandrose/input_css
57
99
  licenses: []
100
+ metadata: {}
58
101
  post_install_message:
59
102
  rdoc_options: []
60
103
  require_paths:
61
104
  - lib
62
105
  required_ruby_version: !ruby/object:Gem::Requirement
63
- none: false
64
106
  requirements:
65
- - - ! '>='
107
+ - - ">="
66
108
  - !ruby/object:Gem::Version
67
109
  version: '0'
68
110
  required_rubygems_version: !ruby/object:Gem::Requirement
69
- none: false
70
111
  requirements:
71
- - - ! '>='
112
+ - - ">="
72
113
  - !ruby/object:Gem::Version
73
114
  version: '0'
74
115
  requirements: []
75
- rubyforge_project: input_css
76
- rubygems_version: 1.8.25
116
+ rubygems_version: 3.1.6
77
117
  signing_key:
78
- specification_version: 3
118
+ specification_version: 4
79
119
  summary: Adds CSS classes for Rails input tags
80
120
  test_files: []
data/init.rb DELETED
@@ -1 +0,0 @@
1
- require 'input_css'
data/install.rb DELETED
@@ -1 +0,0 @@
1
- # Install hook code here
data/spec/rcov.opts DELETED
@@ -1,4 +0,0 @@
1
- --exclude
2
- gems
3
- --exclude
4
- spec
data/spec/spec.opts DELETED
@@ -1,5 +0,0 @@
1
- --colour
2
- --backtrace
3
- --format
4
- specdoc
5
- --diff
data/uninstall.rb DELETED
@@ -1 +0,0 @@
1
- # Uninstall hook code here