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
175
176
177
|
# File 'lib/chop/form.rb', line 175
def self.css_selector
"select"
end
|
Instance Method Details
#diff_value ⇒ Object
193
194
195
|
# File 'lib/chop/form.rb', line 193
def diff_value
get_value.to_s
end
|
#fill_in! ⇒ Object
183
184
185
|
# File 'lib/chop/form.rb', line 183
def fill_in!
session.select value, from: label
end
|
#get_value ⇒ Object
187
188
189
190
191
|
# File 'lib/chop/form.rb', line 187
def get_value
if selected_value = field.value
field.find("option[value='#{selected_value}']").text
end
end
|
#matches? ⇒ Boolean
179
180
181
|
# File 'lib/chop/form.rb', line 179
def matches?
field.tag_name == "select" && field[:multiple].to_s == "false"
end
|