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