Class: Watir::CheckBox

Inherits:
Object
  • Object
show all
Defined in:
lib/watir-formhandler/check_box.rb

Overview

Extends the Watir::Checkbox class with set and field_value methods.

Instance Method Summary collapse

Instance Method Details

#field_valueBoolean

Returns whether this CheckBox is set or not.

Returns:

  • (Boolean)

    is checked?



17
18
19
# File 'lib/watir-formhandler/check_box.rb', line 17

def field_value
  checked?
end

#set(value) ⇒ Boolean

Will click the CheckBox unless the #checked? returns the same value as the given one.

Parameters:

  • value (Boolean)

    the value to achieve on the CheckBox.

Returns:

  • (Boolean)

    the new value of this CheckBox.



10
11
12
# File 'lib/watir-formhandler/check_box.rb', line 10

def set(value)
  click unless !!value == checked?
end