class YuiRestClient::Widgets::Checkbox

Class representing a Checkbox in UI. It can be YCheckBox or YCheckBoxFrame.

Public Instance Methods

check() click to toggle source

Sends action to explicitly check the checkbox in UI (regardless of the current state). @return [Checkbox] in case action is successful @example Check checkbox with id 'test'

app.checkbox(id: 'test').check
# File lib/yui_rest_client/widgets/checkbox.rb, line 11
def check
  action(action: Actions::CHECK)
  self
end
checked?() click to toggle source

Returns the state of checkbox (checked/unchecked). Gets value from 'value' parameter in JSON representation of YCheckBox or YCheckBoxFrame. @return [Boolean] true if it is checked, false otherwise. @example Get checkbox state

{
  "class": "YCheckBox",
  "debug_label": "Change the Time Now",
  "id": "change_now",
  "label": "Chan&ge the Time Now",
  "notify": true,
  "value": true
}

@example

app.checkbox(id: 'change_now').checked? # true
# File lib/yui_rest_client/widgets/checkbox.rb, line 30
def checked?
  property(:value)
end
toggle() click to toggle source

Sends action to toggle the checkbox in UI (i.e. uncheck when checked, or check otherwise). @return [Checkbox] in case action is successful @example Toggle checkbox with id 'test'

app.checkbox(id: 'test').toggle
# File lib/yui_rest_client/widgets/checkbox.rb, line 38
def toggle
  action(action: Actions::TOGGLE)
  self
end
uncheck() click to toggle source

Sends action to explicitly uncheck the checkbox in UI (regardless of the current state). @return [Checkbox] in case action is successful @example Uncheck checkbox with id 'test'

checkbox(id: 'test').uncheck
# File lib/yui_rest_client/widgets/checkbox.rb, line 47
def uncheck
  action(action: Actions::UNCHECK)
  self
end