lib/capybara/rspec/matchers.rb in capybara-3.39.2 vs lib/capybara/rspec/matchers.rb in capybara-3.40.0
- old
+ new
@@ -75,16 +75,21 @@
# @!method match_css(css, **options, &optional_filter_block)
# RSpec matcher for whether the current element matches a given css selector.
#
# @see Capybara::Node::Matchers#matches_css?
- %i[link button field select table].each do |selector|
+ %i[link button field select table element].each do |selector|
define_method "have_#{selector}" do |locator = nil, **options, &optional_filter_block|
Matchers::HaveSelector.new(selector, locator, **options, &optional_filter_block)
end
end
+ # @!method have_element(locator = nil, **options, &optional_filter_block)
+ # RSpec matcher for elements.
+ #
+ # @see Capybara::Node::Matchers#has_element?
+
# @!method have_link(locator = nil, **options, &optional_filter_block)
# RSpec matcher for links.
#
# @see Capybara::Node::Matchers#has_link?
@@ -159,10 +164,10 @@
match_style(styles, **options)
end
%w[selector css xpath text title current_path link button
field checked_field unchecked_field select table
- sibling ancestor].each do |matcher_type|
+ sibling ancestor element].each do |matcher_type|
define_method "have_no_#{matcher_type}" do |*args, **kw_args, &optional_filter_block|
Matchers::NegatedMatcher.new(send("have_#{matcher_type}", *args, **kw_args, &optional_filter_block))
end
end
alias_method :have_no_content, :have_no_text