Class: Chop::Form::Select
- Inherits:
-
Field
- Object
- Struct
- Field
- Chop::Form::Select
show all
- Defined in:
- lib/chop/form.rb
Instance Attribute Summary
Attributes inherited from Field
#field, #label, #path, #session, #value
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Field
candidates, combined_css_selector, for, from, #label_text, #should_include_in_diff?, #to_diff_row
Class Method Details
.css_selector ⇒ Object
183
184
185
|
# File 'lib/chop/form.rb', line 183
def self.css_selector
"select"
end
|
Instance Method Details
#diff_value ⇒ Object
201
202
203
|
# File 'lib/chop/form.rb', line 201
def diff_value
get_value.to_s
end
|
#fill_in! ⇒ Object
191
192
193
|
# File 'lib/chop/form.rb', line 191
def fill_in!
session.select value, from: label
end
|
#get_value ⇒ Object
195
196
197
198
199
|
# File 'lib/chop/form.rb', line 195
def get_value
if selected_value = field.value
field.find("option[value='#{selected_value}']").text
end
end
|
#matches? ⇒ Boolean
187
188
189
|
# File 'lib/chop/form.rb', line 187
def matches?
field.tag_name == "select" && field[:multiple].to_s == "false"
end
|