Class: Capybara::Queries::AncestorQuery Private
- Inherits:
-
SelectorQuery
- Object
- BaseQuery
- SelectorQuery
- Capybara::Queries::AncestorQuery
- 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
Instance Attribute Summary
Attributes inherited from SelectorQuery
#expression, #locator, #options, #selector
Attributes inherited from BaseQuery
Instance Method Summary collapse
- #description(applied = false) ⇒ Object private
-
#initialize(*args) ⇒ AncestorQuery
constructor
private
A new instance of AncestorQuery.
- #resolve_for(node, exact = nil) ⇒ Object private
Methods inherited from SelectorQuery
#applied_description, #css, #exact?, #failure_message, #label, #match, #matches_filters?, #name, #negative_failure_message, #supports_exact?, #visible, #xpath
Methods inherited from BaseQuery
#expects_none?, #failure_message, #matches_count?, #negative_failure_message, wait, #wait
Constructor Details
#initialize(*args) ⇒ AncestorQuery
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.
Returns a new instance of AncestorQuery.
6 7 8 9 10 11 12 |
# File 'lib/capybara/queries/ancestor_query.rb', line 6 def initialize(*args) super @count_options = {} COUNT_KEYS.each do |key| @count_options[key] = @options.delete(key) if @options.key?(key) end end |
Instance Method Details
#description(applied = false) ⇒ 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.
23 24 25 26 27 28 |
# File 'lib/capybara/queries/ancestor_query.rb', line 23 def description(applied = false) 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) ⇒ 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.
15 16 17 18 19 20 21 |
# File 'lib/capybara/queries/ancestor_query.rb', line 15 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, **@count_options) { |el| match_results.include?(el) } end end |