Sha256: 00cd5e85b1bffe9467aedff1f382a7abea0a10abdba6aa3a93cc64135a270e78

Contents?: true

Size: 796 Bytes

Versions: 9

Compression:

Stored size: 796 Bytes

Contents

module TestCentricity
  class AppCheckBox < AppUIElement
    def initialize(name, parent, locator, context)
      super
      @type  = :checkbox
    end

    def checked?
      obj = element
      object_not_found_exception(obj)
      obj.selected?
    end

    # Set the check state of a checkbox object.
    #
    # @example
    #   remember_me_checkbox.check
    #
    def check
      set_checkbox_state(true)
    end

    # Uncheck a checkbox object.
    #
    # @example
    #   remember_me_checkbox.uncheck
    #
    def uncheck
      set_checkbox_state(false)
    end

    def set_checkbox_state(state)
      obj = element
      object_not_found_exception(obj)
      if state
        obj.click unless obj.selected?
      else
        obj.click if obj.selected?
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
testcentricity-3.1.1 lib/testcentricity/app_elements/checkbox.rb
testcentricity-3.1.0 lib/testcentricity/app_elements/checkbox.rb
testcentricity-3.0.6 lib/testcentricity/app_elements/checkbox.rb
testcentricity-3.0.5 lib/testcentricity/app_elements/checkbox.rb
testcentricity-3.0.4 lib/testcentricity/app_elements/checkbox.rb
testcentricity-3.0.3 lib/testcentricity/app_elements/checkbox.rb
testcentricity-3.0.2 lib/testcentricity/app_elements/checkbox.rb
testcentricity-3.0.1 lib/testcentricity/app_elements/checkbox.rb
testcentricity-3.0.0 lib/testcentricity/app_elements/checkbox.rb