Class: Wrapybara::TableHead

Inherits:
Object
  • Object
show all
Includes:
Element
Defined in:
lib/wrapybara/elements/table_head.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Element

#click, #default_how, #default_scope, #disabled?, #element_identifier, #enabled?, #exists?, #focused?, #get_element, #parent_identifier, #path, #should_be_disabled, #should_be_enabled, #should_be_focused, #should_be_visible, #should_have_attribute, #should_not_be_disabled, #should_not_be_enabled, #should_not_be_focused, #should_not_be_visible, #should_not_have_attribute, #style, #visible?, #within

Constructor Details

#initialize(table) ⇒ TableHead

Returns a new instance of TableHead.



7
8
9
10
# File 'lib/wrapybara/elements/table_head.rb', line 7

def initialize(table)
  @parent = table
  @element = table.element.find('thead') rescue nil
end

Instance Attribute Details

#elementObject (readonly)

Returns the value of attribute element.



5
6
7
# File 'lib/wrapybara/elements/table_head.rb', line 5

def element
  @element
end

#parentObject (readonly)

Returns the value of attribute parent.



5
6
7
# File 'lib/wrapybara/elements/table_head.rb', line 5

def parent
  @parent
end

Instance Method Details

#cell(*args) ⇒ Object



20
21
22
# File 'lib/wrapybara/elements/table_head.rb', line 20

def cell(*args)
  TableCell.new(self, args)
end

#has_column?(label) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/wrapybara/elements/table_head.rb', line 24

def has_column?(label)
  self.cell(label).exists?
end

#should_existObject



12
13
14
# File 'lib/wrapybara/elements/table_head.rb', line 12

def should_exist
  super "Expected table #{self.parent_identifier} to have a head"
end

#should_have_cells(labels) ⇒ Object



28
29
30
31
32
# File 'lib/wrapybara/elements/table_head.rb', line 28

def should_have_cells(labels)
  labels.each do |label|
    self.cell(label).should_exist
  end
end

#should_not_existObject



16
17
18
# File 'lib/wrapybara/elements/table_head.rb', line 16

def should_not_exist
  super "Did not expect table #{self.parent_identifier} to have a head"
end

#should_not_have_cells(labels) ⇒ Object



34
35
36
37
38
# File 'lib/wrapybara/elements/table_head.rb', line 34

def should_not_have_cells(labels)
  labels.each do |label|
    self.cell(label).should_not_exist
  end
end