class Accessibility::HasChildMatcher

Custom matcher for RSpec to check if an element has the specified child element.

Public Instance Methods

description() click to toggle source

@return [String]

# File lib/rspec/expectations/ax_elements.rb, line 65
def description
"should have a child that matches #{qualifier.describe}"
end
failure_message_for_should() click to toggle source

@return [String]

# File lib/rspec/expectations/ax_elements.rb, line 55
def failure_message_for_should
  "Expected #@parent to have child #{qualifier.describe}"
end
failure_message_for_should_not() click to toggle source

@return [String]

# File lib/rspec/expectations/ax_elements.rb, line 60
def failure_message_for_should_not
  "Expected #@parent to NOT have child #@result"
end
matches?(parent) click to toggle source

@param parent [AX::Element]

# File lib/rspec/expectations/ax_elements.rb, line 48
def matches? parent
  @parent = parent
  @result = parent.children.find { |x| qualifier.qualifies? x }
  !@result.blank?
end