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
185
186
187
|
# File 'lib/chop/form.rb', line 185
def self.css_selector
"select"
end
|
Instance Method Details
#diff_value ⇒ Object
203
204
205
|
# File 'lib/chop/form.rb', line 203
def diff_value
get_value.to_s
end
|
#fill_in! ⇒ Object
193
194
195
|
# File 'lib/chop/form.rb', line 193
def fill_in!
session.select value, from: label
end
|
#get_value ⇒ Object
197
198
199
200
201
|
# File 'lib/chop/form.rb', line 197
def get_value
if selected_value = field.value
field.find("option[value='#{selected_value}']").text
end
end
|
#matches? ⇒ Boolean
189
190
191
|
# File 'lib/chop/form.rb', line 189
def matches?
field.tag_name == "select" && field[:multiple].to_s == "false"
end
|