Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Make expect_value actually check value

Christophe Bliard6d657f794da3
diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb
index 56b37ab4b85..fcc63cf2e96 100644
--- a/spec/support/capybara.rb
+++ b/spec/support/capybara.rb
@@ -40,6 +40,16 @@ RSpec.configure do |config|
# Set the default options
config.include_context 'with default_url_options set', type: :feature
+
+ # Make it possible to match on value attribute.
+ #
+ # For instance:
+ #
+ # expect(page).to have_selector(".date input", value: "2022-11-17")
+ #
+ Capybara.modify_selector(:css) do
+ filter(:value) { |node, v| node.value == v }
+ end
end
##
diff --git a/spec/support/edit_fields/date_edit_field.rb b/spec/support/edit_fields/date_edit_field.rb
index 7eee541ab4e..d8421381060 100644
--- a/spec/support/edit_fields/date_edit_field.rb
+++ b/spec/support/edit_fields/date_edit_field.rb
@@ -146,9 +146,7 @@ class DateEditField < EditField
end
def expect_value(value)
- expect(page).to have_selector (".#{property_name} input") do |input|
- input.value == value
- end
+ expect(page).to have_selector(".#{property_name} input", value:)
end
def set_active_date(value)