Class: JQueryUIWidgets::Accordion
- Inherits:
-
PageObject::Elements::Div
- Object
- PageObject::Elements::Div
- JQueryUIWidgets::Accordion
- Defined in:
- lib/jqueryui_widgets/accordion.rb
Overview
Accordion class to make use of the Accordion widget.
NOTE: Since JQueryUI Widgets are completely customizable, we’ve kept the Accordion class limited to basic functionality so that end users can pick up the gem and customize it to suit their own needs.
Instance Method Summary collapse
-
#labels ⇒ Object
labels method will map all of the headers in the accordion to an array to allow for comparison.
-
#select(item) ⇒ Object
Select method will take a single parameter and click on the h3 element to select it.
-
#selected ⇒ Object
Selected method will check the currently selected accordion element by checking if the class ‘ui-accordin-header-active’ is present within the accordion element.
-
#selected?(label) ⇒ Boolean
Selected? compares the passed in label with the current h3_element text and returns a boolean result.
Instance Method Details
#labels ⇒ Object
labels method will map all of the headers in the accordion to an array to allow for comparison.
63 64 65 |
# File 'lib/jqueryui_widgets/accordion.rb', line 63 def labels headers.map(&:text) end |
#select(item) ⇒ Object
Select method will take a single parameter and click on the h3 element to select it.
22 23 24 25 26 27 28 29 |
# File 'lib/jqueryui_widgets/accordion.rb', line 22 def select(item) the_accordions = headers index = the_accordions.find_index do |accordion| accordion.text == item end the_accordions[index].click wait_for_content(index) end |
#selected ⇒ Object
Selected method will check the currently selected accordion element by checking if the class ‘ui-accordin-header-active’ is present within the accordion element.
37 38 39 |
# File 'lib/jqueryui_widgets/accordion.rb', line 37 def selected h3_element(:class => 'ui-accordion-header-active').text end |
#selected?(label) ⇒ Boolean
Selected? compares the passed in label with the current h3_element text and returns a boolean result.
54 55 56 |
# File 'lib/jqueryui_widgets/accordion.rb', line 54 def selected?(label) selected == label end |