class YuiRestClient::Widgets::Tab

Class representing a tab in the UI. It can be YDumbTab.

Public Instance Methods

items() click to toggle source

Returns the list of items available to select from tab. @return [Array] array of String objects. @example Get items from tab with id “test_id”

{
  "class": "YDumbTab",
  "debug_label": "YDumbTab [tab1] [tab2] [tab3]",
  "hstretch": true,
  "icon_base_path": "",
  "id": "test_id",
  "items": [
    {
      "label": "tab1"
    },
    {
      "label": "tab2",
      "selected": true
    },
    {
      "label": "tab3"
    }
  ],
  "items_count": 3,
  "vstretch": true
}

@example

app.tab(id: 'test').items
# tab1
# tab2
# tab3
# File lib/yui_rest_client/widgets/tab.rb, line 36
def items
  property(:items).map { |x| x[:label] }
end
select(item) click to toggle source

Sends action to click the tab in UI. @param item [String] value to select from items. @return [Tab] in case action is successful @example Click tab with id 'test'

app.button(id: 'test', value: test_item).select
# File lib/yui_rest_client/widgets/tab.rb, line 45
def select(item)
  action(action: Actions::SELECT, value: item)
  self
end
selected_item() click to toggle source

Returns the label of the selected tab. @return [String] label of the tab selected @example Get items from tab with id “test_id”

{
  "class": "YDumbTab",
  "debug_label": "YDumbTab [tab1] [tab2] [tab3]",
  "hstretch": true,
  "icon_base_path": "",
  "id": "test_id",
  "items": [
    {
      "label": "tab1"
    },
    {
      "label": "tab2",
      "selected": true
    },
    {
      "label": "tab3"
    }
  ],
  "items_count": 3,
  "vstretch": true
}

@example

app.tab(id: 'test').selected_item  # tab2
# File lib/yui_rest_client/widgets/tab.rb, line 76
def selected_item
  property(:items).select { |x| x[:selected] }.first[:label]
end