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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Add Capybara selector, matchers for Octicon
Alexander Brandon Colesf29e6c9828dc
diff --git a/spec/support/capybara/primer_component_selectors.rb b/spec/support/capybara/primer_component_selectors.rbindex ccdce423dce..719bca82dd6 100644--- a/spec/support/capybara/primer_component_selectors.rb+++ b/spec/support/capybara/primer_component_selectors.rb@@ -55,6 +55,30 @@ Capybara.add_selector :primer_label, locator_type: [String, Symbol] doendend+Capybara.add_selector :octicon, locator_type: [String, Symbol] do+ label "Octicon"++ xpath do |locator|+ xpath = XPath.descendant(:svg)+ xpath = builder(xpath).add_attribute_conditions(class: "octicon")+ xpath = builder(xpath).add_attribute_conditions(class: "octicon-#{locator.to_s.downcase}") if locator+ xpath+ end++ expression_filter(:size, valid_values: [Numeric, *Primer::Beta::Octicon::SIZE_OPTIONS]) do |expr, size|+ px_size = size.is_a?(Numeric) ? size : Primer::Beta::Octicon::SIZE_MAPPINGS.fetch(size)+ builder(expr).add_attribute_conditions(width: px_size, height: px_size)+ end++ describe_expression_filters do |size: nil, **|+ desc = +""+ if size.present?+ desc << size.is_a?(Numeric) ? " with size #{size}px" : " with #{size} size"+ end+ desc+ end+end+module Capybaramodule RSpecMatchersdef have_primer_label(locator = nil, **, &)@@ -64,5 +88,13 @@ module Capybaradef have_no_primer_label(...)Matchers::NegatedMatcher.new(have_primer_label(...))end++ def have_octicon(locator = nil, **, &)+ Matchers::HaveSelector.new(:octicon, locator, **, &)+ end++ def have_no_octicon(...)+ Matchers::NegatedMatcher.new(have_octicon(...))+ endendend