Class: Cucumber::Salad::Widgets::FieldGroup::Select
- Defined in:
- lib/cucumber/salad/widgets/field_group.rb
Overview
A select.
Instance Attribute Summary
Attributes inherited from Widget
Instance Method Summary collapse
-
#get ⇒ String
The text of the selected option.
-
#set(option) ⇒ Object
Selects the given option.
-
#to_s ⇒ Object
The text of the selected option, or the empty string if no option is selected.
Methods inherited from Field
Methods inherited from Widget
find_in, #has_action?, #initialize, #inspect, present_in?, #reload, root, selector
Methods included from Cucumber::Salad::WidgetMacros
#action, #widget, #widget_delegator
Methods included from Cucumber::Salad::WidgetContainer
Constructor Details
This class inherits a constructor from Cucumber::Salad::Widgets::Widget
Instance Method Details
#get ⇒ String
Returns The text of the selected option.
293 294 295 296 297 |
# File 'lib/cucumber/salad/widgets/field_group.rb', line 293 def get option = root.find('[selected]') rescue nil option && option.text end |
#set(option) ⇒ Object
Selects the given option.
302 303 304 |
# File 'lib/cucumber/salad/widgets/field_group.rb', line 302 def set(option) root.find('option', text: option).select_option end |
#to_s ⇒ Object
Returns the text of the selected option, or the empty string if no option is selected.
309 |
# File 'lib/cucumber/salad/widgets/field_group.rb', line 309 def_delegator :get, :to_s |