Class: Dill::RadioButton
- Defined in:
- lib/dill/widgets/radio_button.rb
Overview
A radio button.
Constant Summary
Constants included from Dill
Instance Attribute Summary
Attributes inherited from Widget
Class Method Summary collapse
Instance Method Summary collapse
-
#get ⇒ Object
no button is checked.
-
#id ⇒ String
The id of the checked button.
-
#set(str) ⇒ Object
First attempts to choose the button by id or label text Then attempts to choose the button by value.
- #to_cell ⇒ Object
-
#value ⇒ String
The value of the checked button.
Methods inherited from Widget
action, #class?, #classes, #click, #double_click, filter, filter?, find_all_in, find_in, #has_action?, #hover, #html, #initialize, not_present_in?, present_in?, #right_click, selector, #text, #to_s, widget_delegator
Methods included from Widgets::DSL
Methods included from WidgetParts::Container
#has_widget?, #not_visible?, #visible?, #widget, #widgets
Methods included from Dill
Methods included from Constructors
Methods included from WidgetParts::Struct
Constructor Details
This class inherits a constructor from Dill::Widget
Class Method Details
.root(selector) ⇒ Object
16 17 18 |
# File 'lib/dill/widgets/radio_button.rb', line 16 def self.root(selector) super(["#{selector}"]) end |
Instance Method Details
#get ⇒ Object
no button is checked.
21 22 23 24 25 26 27 28 29 |
# File 'lib/dill/widgets/radio_button.rb', line 21 def get if visible?(:checked_label_by_value, value) (:checked_label_by_value, value).text elsif visible?(:checked_label_by_id, id) (:checked_label_by_id, id).text else nil end end |
#id ⇒ String
Returns The id of the checked button.
37 38 39 |
# File 'lib/dill/widgets/radio_button.rb', line 37 def id visible?(:checked) ? (:checked).id : nil end |
#set(str) ⇒ Object
First attempts to choose the button by id or label text Then attempts to choose the button by value
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/dill/widgets/radio_button.rb', line 43 def set(str) root.choose(str) rescue begin (:button_by_value, str).root.set(true) rescue Dill::MissingWidget => e raise InvalidRadioButton.new(e.). tap { |x| x.set_backtrace e.backtrace } end end |
#to_cell ⇒ Object
58 59 60 |
# File 'lib/dill/widgets/radio_button.rb', line 58 def to_cell get end |