Class: Capybara::Queries::AncestorQuery Private
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
SelectorQuery ,
BaseQuery
|
|
Instance Chain:
self,
SelectorQuery ,
BaseQuery
|
|
Inherits: |
Capybara::Queries::SelectorQuery
|
Defined in: | lib/capybara/queries/ancestor_query.rb |
Constant Summary
Class Method Summary
Instance Attribute Summary
SelectorQuery
- Inherited
BaseQuery
- Inherited
#expects_none? | Checks if a count of 0 is valid for the query Returns false if query does not have any count options specified. |
#options, #session_options, #session_options=, #count_specified? |
Instance Method Summary
- #description(applied = false) Internal use only
- #resolve_for(node, exact = nil) Internal use only Internal use only
SelectorQuery
- Inherited
BaseQuery
- Inherited
#failure_message | Generates a failure message from the query description and count options. |
#matches_count? | Checks if the given count matches the query count options. |
#negative_failure_message, #wait, #assert_valid_keys, #count_message, #occurrences |
Constructor Details
This class inherits a constructor from Capybara::Queries::SelectorQuery
Instance Method Details
#description(applied = false)
[ GitHub ]# File 'lib/capybara/queries/ancestor_query.rb', line 20
def description(applied = false) # rubocop:disable Style/OptionalBooleanParameter child_query = @child_node&.instance_variable_get(:@query) desc = super desc += " that is an ancestor of #{child_query.description}" if child_query desc end
#resolve_for(node, exact = nil)
This method is for internal use only.
[ GitHub ]
# File 'lib/capybara/queries/ancestor_query.rb', line 7
def resolve_for(node, exact = nil) @child_node = node node.synchronize do scope = node.respond_to?(:session) ? node.session.current_scope : node.find(:xpath, '/*') match_results = super(scope, exact) ancestors = node.find_xpath(XPath.ancestor.to_s) .map(&method(:to_element)) .select { |el| match_results.include?(el) } Capybara::Result.new(ordered_results(ancestors), self) end end