Class: SitePrism::Section
- Inherits:
-
Object
- Object
- SitePrism::Section
- Extended by:
- ElementContainer
- Includes:
- Capybara::DSL, ElementChecker, Loadable
- Defined in:
- lib/site_prism/section.rb
Instance Attribute Summary collapse
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#root_element ⇒ Object
readonly
Returns the value of attribute root_element.
Attributes included from ElementContainer
Attributes included from Loadable
Instance Method Summary collapse
- #evaluate_script(input) ⇒ Object
- #execute_script(input) ⇒ Object
-
#initialize(parent, root_element) ⇒ Section
constructor
A new instance of Section.
- #parent_page ⇒ Object
- #text ⇒ Object
- #visible? ⇒ Boolean
Methods included from ElementContainer
add_to_mapped_items, element, elements, iframe, raise_if_block, section, sections
Methods included from Loadable
included, #loaded?, #when_loaded
Methods included from ElementChecker
Constructor Details
#initialize(parent, root_element) ⇒ Section
Returns a new instance of Section.
12 13 14 15 16 |
# File 'lib/site_prism/section.rb', line 12 def initialize(parent, root_element) @parent = parent @root_element = root_element Capybara.within(@root_element) { yield(self) } if block_given? end |
Instance Attribute Details
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
10 11 12 |
# File 'lib/site_prism/section.rb', line 10 def parent @parent end |
#root_element ⇒ Object (readonly)
Returns the value of attribute root_element.
10 11 12 |
# File 'lib/site_prism/section.rb', line 10 def root_element @root_element end |
Instance Method Details
#evaluate_script(input) ⇒ Object
30 31 32 |
# File 'lib/site_prism/section.rb', line 30 def evaluate_script(input) Capybara.current_session.evaluate_script input end |
#execute_script(input) ⇒ Object
26 27 28 |
# File 'lib/site_prism/section.rb', line 26 def execute_script(input) Capybara.current_session.execute_script input end |
#parent_page ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/site_prism/section.rb', line 34 def parent_page candidate_page = parent until candidate_page.is_a?(SitePrism::Page) candidate_page = candidate_page.parent end candidate_page end |
#text ⇒ Object
22 23 24 |
# File 'lib/site_prism/section.rb', line 22 def text root_element.text end |
#visible? ⇒ Boolean
18 19 20 |
# File 'lib/site_prism/section.rb', line 18 def visible? root_element.visible? end |