Sha256: dadd18103f9c14eab9c98765b58769f4c0bc141f6e168c5809494e53cd349d96

Contents?: true

Size: 715 Bytes

Versions: 5

Compression:

Stored size: 715 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&.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

5 entries across 5 versions & 2 rubygems

Version Path
tdiary-5.0.9 vendor/bundle/gems/capybara-3.2.1/lib/capybara/queries/ancestor_query.rb
capybara-3.3.1 lib/capybara/queries/ancestor_query.rb
capybara-3.3.0 lib/capybara/queries/ancestor_query.rb
capybara-3.2.1 lib/capybara/queries/ancestor_query.rb
capybara-3.2.0 lib/capybara/queries/ancestor_query.rb