bemer-simple_form 0.2.0 → 0.2.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2593c0ef8783cc1217324657e384d4ad287d9d0fa2437b526b1c22a66dd000dc
|
4
|
+
data.tar.gz: 12415d8531d13d2c8a1d0e5cad63395ce13a5eb26a73ef8653801fcf95a012e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 532f7d5687ebcdc8808cb64df4b1231cc7f8db55b01eb35d01c94e1112505bc9873b6200516587f263f010c6feea31627c1d89eff73a6c12232992518b978eb6
|
7
|
+
data.tar.gz: 5394c4273000ee0089f387bb7129d0804e8415e840cc139572deaae8e8828735ca012c73d9dda8c797bebbafb3dfa930094a592bd2e1849ae46c242b7c23a568
|
@@ -39,17 +39,17 @@ module Bemer
|
|
39
39
|
def extract_elem_name_for!(namespace, default_name) # rubocop:disable Metrics/AbcSize
|
40
40
|
elem = bem_options_for(namespace).delete(:elem)
|
41
41
|
|
42
|
-
return
|
42
|
+
return elem unless elem.nil?
|
43
43
|
|
44
44
|
elem = default_name.nil? ? reflection_or_attribute_name : default_name
|
45
45
|
|
46
|
-
return
|
46
|
+
return elem if Bemer.bem_class(block_entity.block, elem).blank?
|
47
47
|
|
48
48
|
suffix = namespace.to_s.chomp('_html') unless namespace.eql?(:input_html)
|
49
49
|
|
50
50
|
namespaced_elem = [elem, suffix].compact.join('_').to_sym
|
51
51
|
|
52
|
-
Bemer::SimpleForm.transform_element_name(namespace, block_entity.block, namespaced_elem, elem)
|
52
|
+
default_name.nil? ? Bemer::SimpleForm.transform_element_name(namespace, block_entity.block, namespaced_elem, elem) : namespaced_elem
|
53
53
|
end
|
54
54
|
# rubocop:enable Metrics/LineLength
|
55
55
|
|
@@ -150,5 +150,43 @@ RSpec.describe 'simple_form_for helper' do
|
|
150
150
|
with_tag :input, with: { class: 'form__submit-button' }, count: 1
|
151
151
|
end
|
152
152
|
end
|
153
|
+
|
154
|
+
it do
|
155
|
+
form = simple_form_for :form do |f|
|
156
|
+
f.input :user_ids, elem: :user_ids
|
157
|
+
end
|
158
|
+
|
159
|
+
expect(form).to have_tag(:form, with: { class: 'form' }, count: 1) do
|
160
|
+
with_tag :div, with: { class: 'form__user-ids-wrapper' }, count: 1
|
161
|
+
with_tag :label, with: { class: 'form__user-ids-label' }, count: 1
|
162
|
+
with_tag :input, with: { class: 'form__user-ids' }, count: 1
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
it do
|
167
|
+
form = simple_form_for :form do |f|
|
168
|
+
f.input :user_ids, input_html: { elem: :user_ids }
|
169
|
+
end
|
170
|
+
|
171
|
+
expect(form).to have_tag(:form, with: { class: 'form' }, count: 1) do
|
172
|
+
with_tag :div, with: { class: 'form__users-wrapper' }, count: 1
|
173
|
+
with_tag :label, with: { class: 'form__users-label' }, count: 1
|
174
|
+
with_tag :input, with: { class: 'form__user-ids' }, count: 1
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
['', false].each do |elem|
|
179
|
+
it do
|
180
|
+
form = simple_form_for :form do |f|
|
181
|
+
f.input :user_ids, elem: elem
|
182
|
+
end
|
183
|
+
|
184
|
+
expect(form).to have_tag(:form, with: { class: 'form' }, count: 1) do
|
185
|
+
without_tag 'div[class]'
|
186
|
+
without_tag 'label[class]'
|
187
|
+
without_tag 'input[class]'
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
153
191
|
end
|
154
192
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bemer-simple_form
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Grigorev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: appraisal
|