Class: SitePrism::Section

Inherits:
Object
  • Object
show all
Extended by:
ElementContainer
Includes:
Capybara::DSL, ElementChecker
Defined in:
lib/site_prism/section.rb

Instance Attribute Summary collapse

Attributes included from ElementContainer

#mapped_items

Instance Method Summary collapse

Methods included from ElementContainer

add_to_mapped_items, element, elements, iframe, raise_if_block, section, sections

Methods included from ElementChecker

#all_there?

Constructor Details

#initialize(parent, root_element) ⇒ Section



9
10
11
12
# File 'lib/site_prism/section.rb', line 9

def initialize(parent, root_element)
  @parent = parent
  @root_element = root_element
end

Instance Attribute Details

#parentObject (readonly)

Returns the value of attribute parent



7
8
9
# File 'lib/site_prism/section.rb', line 7

def parent
  @parent
end

#root_elementObject (readonly)

Returns the value of attribute root_element



7
8
9
# File 'lib/site_prism/section.rb', line 7

def root_element
  @root_element
end

Instance Method Details

#evaluate_script(input) ⇒ Object



22
23
24
# File 'lib/site_prism/section.rb', line 22

def evaluate_script(input)
  Capybara.current_session.evaluate_script input
end

#execute_script(input) ⇒ Object



18
19
20
# File 'lib/site_prism/section.rb', line 18

def execute_script(input)
  Capybara.current_session.execute_script input
end

#parent_pageObject



26
27
28
29
30
31
32
# File 'lib/site_prism/section.rb', line 26

def parent_page
  candidate_page = parent
  until candidate_page.is_a?(SitePrism::Page)
    candidate_page = candidate_page.parent
  end
  candidate_page
end

#visible?Boolean



14
15
16
# File 'lib/site_prism/section.rb', line 14

def visible?
  root_element.visible?
end