Class: AePageObjects::Element
  
  
  
  
  
    - Inherits:
- 
      Node
      
        
          - Object
- Node
- AePageObjects::Element
 show all
    - Defined in:
- lib/ae_page_objects/element.rb
 
  Constant Summary
  
  
  Node::Methods::METHODS_TO_DELEGATE_TO_NODE
  Instance Attribute Summary collapse
  
  
    
      Instance Method Summary
      collapse
    
    
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  Methods included from Dsl
  #collection, #element, #form_for, #inherited
  
  
  
  
  
  
  
  
  
  #ensure_class_for_param!
  
  
  
  
  
  
  
  
  
  #current_url, #current_url_without_params, #new_subclass
  
  
  
  
  
  
  
  
  
  #node, #stale?
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  #current_url, #current_url_without_params, #node
  Constructor Details
  
    
  
  
    #initialize(parent, options_or_locator = {})  ⇒ Element 
  
  
  
  
    
Returns a new instance of Element.
   
 
  
    | 
5
6
7
8
9
10
11
12
13
14
15
16
17 | # File 'lib/ae_page_objects/element.rb', line 5
def initialize(parent, options_or_locator = {})
  @parent       = parent
  @locator      = nil
  @name         = nil
  
  configure(parse_options(options_or_locator))
  raise ArgumentError, ":name or :locator is required" unless @name || @locator
  
  @locator ||= default_locator
  super(scoped_node)
end | 
 
  
 
  
    Instance Attribute Details
    
      
      
      
  
  
    #parent  ⇒ Object  
  
  
  
  
    
Returns the value of attribute parent.
   
 
  
  
    | 
3
4
5 | # File 'lib/ae_page_objects/element.rb', line 3
def parent
  @parent
end | 
 
    
   
  
    Instance Method Details
    
      
  
  
    #__full_name__  ⇒ Object 
  
  
  
  
    | 
31
32
33
34
35
36
37
38
39
40
41
42 | # File 'lib/ae_page_objects/element.rb', line 31
def __full_name__
  if parent.respond_to?(:__full_name__)
    name_parts = [ parent.__full_name__, __name__ ].compact
    if name_parts.empty?
      nil
    else
      name_parts.join('_')
    end
  else
    __name__
  end
end | 
 
    
      
  
  
    #__name__  ⇒ Object 
  
  
  
  
    | 
48
49
50 | # File 'lib/ae_page_objects/element.rb', line 48
def __name__
  @name
end | 
 
    
      
  
  
    #document  ⇒ Object 
  
  
  
  
    | 
19
20
21
22
23
24
25
26
27
28
29 | # File 'lib/ae_page_objects/element.rb', line 19
def document
  @document ||= begin
    node = self.parent
    
    until node.is_a?(::AePageObjects::Document)
      node = node.parent
    end
    
    node
  end
end | 
 
    
      
  
  
    #full_name  ⇒ Object 
  
  
  
  
    | 
44
45
46 | # File 'lib/ae_page_objects/element.rb', line 44
def full_name
  __full_name__
end | 
 
    
      
  
  
    #name  ⇒ Object 
  
  
  
  
    | 
52
53
54 | # File 'lib/ae_page_objects/element.rb', line 52
def name
  __name__
end | 
 
    
      
  
  
    #to_s  ⇒ Object 
  
  
  
  
    | 
56
57
58
59
60 | # File 'lib/ae_page_objects/element.rb', line 56
def to_s
  super.tap do |str|
    str << "@name:<#{@name}>; #@locator:<#{@locator}>"
  end
end | 
 
    
      
  
  
    #using_default_locator?  ⇒ Boolean 
  
  
  
  
    | 
62
63
64 | # File 'lib/ae_page_objects/element.rb', line 62
def using_default_locator?
  @locator == default_locator
end |