Sha256: 979bc51a0c5a0104d98edceda98320f96fb43cd74bc99e71d7d3547630cbfac7

Contents?: true

Size: 732 Bytes

Versions: 39

Compression:

Stored size: 732 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(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

    private

      def valid_keys
        super - COUNT_KEYS
      end
    end
  end
end

Version data entries

39 entries across 38 versions & 2 rubygems

Version Path
capybara-3.21.0 lib/capybara/queries/ancestor_query.rb
capybara-3.20.2 lib/capybara/queries/ancestor_query.rb
capybara-3.20.1 lib/capybara/queries/ancestor_query.rb
capybara-3.20.0 lib/capybara/queries/ancestor_query.rb
capybara-3.19.1 lib/capybara/queries/ancestor_query.rb
capybara-3.19.0 lib/capybara/queries/ancestor_query.rb
capybara-3.18.0 lib/capybara/queries/ancestor_query.rb
capybara-3.15.1 lib/capybara/queries/ancestor_query.rb
capybara-3.17.0 lib/capybara/queries/ancestor_query.rb
capybara-3.16.2 lib/capybara/queries/ancestor_query.rb
tdiary-5.0.13 vendor/bundle/gems/capybara-3.15.0/lib/capybara/queries/ancestor_query.rb
capybara-3.16.1 lib/capybara/queries/ancestor_query.rb
tdiary-5.0.12.1 vendor/bundle/gems/capybara-3.15.0/lib/capybara/queries/ancestor_query.rb
capybara-3.16.0 lib/capybara/queries/ancestor_query.rb
capybara-3.15.0 lib/capybara/queries/ancestor_query.rb
capybara-3.14.0 lib/capybara/queries/ancestor_query.rb
capybara-3.13.2 lib/capybara/queries/ancestor_query.rb
capybara-3.13.1 lib/capybara/queries/ancestor_query.rb
capybara-3.13.0 lib/capybara/queries/ancestor_query.rb
tdiary-5.0.11 vendor/bundle/gems/capybara-3.12.0/lib/capybara/queries/ancestor_query.rb