Class: CapybaraPageObject::Input

Inherits:
FormField show all
Includes:
TextBasedInput
Defined in:
lib/capybara-page-object/elements/input.rb

Constant Summary collapse

BUTTON_TYPES =
['submit', 'reset', 'button']
CHECKABLE_TYPES =
['radio', 'checkbox']

Instance Attribute Summary

Attributes inherited from Node

#source

Instance Method Summary collapse

Methods included from TextBasedInput

#clear!, #key, #value=

Methods inherited from FormField

#blank?

Methods included from HTML5Data

#data

Methods included from Collections

#key, #value

Methods inherited from Node

#classes, element, field, from_string, #initialize

Methods included from Delegators

#all, #find, #text

Constructor Details

This class inherits a constructor from CapybaraPageObject::Node

Instance Method Details

#button?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/capybara-page-object/elements/input.rb', line 17

def button?
  BUTTON_TYPES.include?(source[:type])
end

#checkable?Boolean

Returns:

  • (Boolean)


21
22
23
24
# File 'lib/capybara-page-object/elements/input.rb', line 21

def checkable?
  type = source[:type]
  type && CHECKABLE_TYPES.include?(type)
end

#checked?Boolean

TODO this doesn’t belong here

Returns:

  • (Boolean)


9
10
11
# File 'lib/capybara-page-object/elements/input.rb', line 9

def checked?
  source.checked?
end

#untyped?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/capybara-page-object/elements/input.rb', line 13

def untyped?
  source[:type].nil?
end