lib/watir-webdriver/elements/checkbox.rb in watir-webdriver-0.0.1.dev4 vs lib/watir-webdriver/elements/checkbox.rb in watir-webdriver-0.0.1.dev5

- old
+ new

@@ -4,10 +4,22 @@ identifier :type => 'checkbox' container_method :checkbox collection_method :checkboxes + # + # Set this checkbox to the given value + # + # Example: + # + # checkbox.set? #=> false + # checkbox.set + # checkbox.set? #=> true + # checkbox.set(false) + # checkbox.set? #=> false + # + def set(bool = true) assert_exists assert_enabled if @element.selected? @@ -15,13 +27,24 @@ else @element.click if bool end end + # + # returns true if the element is checked + # @return [Boolean] + # + def set? assert_exists @element.selected? end + + # + # Unset this checkbox. + # + # Same as +set(false)+ + # def clear set false end