Sha256: 36357d740e930bba514a4d528350450cca9f45d81b442e752a27e84674d48b02
Contents?: true
Size: 878 Bytes
Versions: 19
Compression:
Stored size: 878 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) 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 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 end end end
Version data entries
19 entries across 10 versions & 2 rubygems