Class: JQueryUIWidgets::Menus

Inherits:
PageObject::Elements::UnorderedList
  • Object
show all
Defined in:
lib/jqueryui_widgets/menus.rb

Overview

Class that wraps the jQueryUI menu, allowing users to interact with both top level, and nested menus.

NOTE: We’ve kept to the basic functionality of the Menu widget in order to avoid causing difficulty with the usage of the widget since all of the JQuery UI Widgets are so customizable. In this fashion, we allow the user to customize the code to suit their own needs.

Instance Method Summary collapse

Instance Method Details

#search_for(*labels) ⇒ Object

Search_for allows the user to supplement the select method and search for a specific element within a menu or sub-menu.

be found in the order they are given.

Examples:

search_for('Delphi', 'Ada')
will find 'Ada' in the sub-menu.


48
49
50
51
52
53
54
# File 'lib/jqueryui_widgets/menus.rb', line 48

def search_for(*labels)
  the_list_item = nil
  loop_through_menu_items(labels) do |list_item|
    the_list_item = list_item
  end
  the_list_item
end

#select(*labels) ⇒ Object

The select method allows you to pass in a theoretically infinite number of variables from the base source through the step definitions and into page to iterate through the top menu and into any submenus you encounter.

in the order in which they were provided.

Examples:

select('Salzburg', 'Delphi', 'Ada')
will click through the menu 'Salzburg'
the sub menu 'Delphi'
and click on 'Ada' in the final submenu


31
32
33
34
35
# File 'lib/jqueryui_widgets/menus.rb', line 31

def select(*labels)
  loop_through_menu_items(labels) do |list_item|
    list_item.fire_event('onclick')
  end
end