Sha256: e5528e6f2dc3f555d0c67da3358730d7c30ad003bf2a491d114c82074844e322

Contents?: true

Size: 729 Bytes

Versions: 7

Compression:

Stored size: 729 Bytes

Contents

# frozen_string_literal: true

module Capybara
  module Queries
    class AncestorQuery < Capybara::Queries::SelectorQuery
      # @api private
      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) { |el| match_results.include?(el) }
        end
      end

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

    private

      def valid_keys
        super - COUNT_KEYS
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
capybara-3.1.1 lib/capybara/queries/ancestor_query.rb
capybara-3.1.0 lib/capybara/queries/ancestor_query.rb
capybara-3.0.3 lib/capybara/queries/ancestor_query.rb
capybara-3.0.2 lib/capybara/queries/ancestor_query.rb
capybara-3.0.1 lib/capybara/queries/ancestor_query.rb
capybara-3.0.0 lib/capybara/queries/ancestor_query.rb
capybara-3.0.0.rc2 lib/capybara/queries/ancestor_query.rb