Class: Capybara::Queries::AncestorQuery Private

Inherits:
MatchQuery show all
Defined in:
lib/capybara/queries/ancestor_query.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary

Constants inherited from SelectorQuery

SelectorQuery::VALID_KEYS, SelectorQuery::VALID_MATCH

Constants inherited from BaseQuery

BaseQuery::COUNT_KEYS

Instance Attribute Summary

Attributes inherited from SelectorQuery

#expression, #find, #locator, #negative, #options, #selector

Attributes inherited from BaseQuery

#options, #session_options

Instance Method Summary collapse

Methods inherited from MatchQuery

#visible

Methods inherited from SelectorQuery

#css, #exact?, #initialize, #label, #match, #matches_filters?, #name, #supports_exact?, #visible, #xpath

Methods inherited from BaseQuery

#expects_none?, #failure_message, #initialize, #matches_count?, #negative_failure_message, #wait, wait

Constructor Details

This class inherits a constructor from Capybara::Queries::SelectorQuery

Instance Method Details

#descriptionObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



17
18
19
20
21
22
23
# File 'lib/capybara/queries/ancestor_query.rb', line 17

def description
  desc = super
  if @child_node && (child_query = @child_node.instance_variable_get(:@query))
    desc += " that is an ancestor of #{child_query.description}"
  end
  desc
end

#resolve_for(node, exact = nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



7
8
9
10
11
12
13
14
15
# File 'lib/capybara/queries/ancestor_query.rb', line 7

def resolve_for(node, exact = nil)
  @child_node = node
  node.synchronize do
    match_results = super(node.session.current_scope, exact)
    node.all(:xpath, XPath.ancestor) do |el|
      match_results.include?(el)
    end
  end
end