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

[#58160] provide specs for leading visual icon in action menu

Tobias Dillmann32e804da19d0
diff --git a/spec/helpers/sort_helper_spec.rb b/spec/helpers/sort_helper_spec.rb
index 5b5dec2210c..149da1f15ba 100644
--- a/spec/helpers/sort_helper_spec.rb
+++ b/spec/helpers/sort_helper_spec.rb
@@ -310,6 +310,10 @@ RSpec.describe SortHelper do
expect(action_menu.at_css("button#menu-id-button .Button-content .Button-label").text).to eq("Id")
end
+ it "does not render an icon by default" do
+ expect(action_menu.at_css(".generic-table--action-menu-button .Button-leadingVisual")).to be_blank
+ end
+
it "shows sorting actions in the action-menu" do
sort_desc = action_menu.at_css("action-list .ActionListItem a[data-test-selector='id-sort-desc']")
expect(sort_desc.at_css(".ActionListItem-label").text.strip).to eq("Sort descending")
@@ -424,10 +428,12 @@ RSpec.describe SortHelper do
end
end
- context "with a life cycle column" do
+ context "with a life cycle gate column" do
let(:life_cycle_step) { create(:project_gate_definition) }
let(:life_cycle_column) { Queries::Projects::Selects::LifeCycleStep.new("lcsd_#{life_cycle_step.id}") }
+ let(:options) { { caption: life_cycle_step.name } }
+
subject(:output) do
# Not setting any filter column mappings here, so for other column types, this should use the default filter
helper.sort_header_with_action_menu(life_cycle_column,
@@ -439,6 +445,26 @@ RSpec.describe SortHelper do
filter_by = action_menu.at_css("action-list .ActionListItem button[data-test-selector='id-filter-by']")
expect(filter_by).to be_nil
end
+
+ it "shows a diamond icon in the header for gates" do
+ icon = action_menu.at_css(".generic-table--action-menu-button .Button-leadingVisual .octicon-diamond")
+ expect(icon).to be_present
+
+ header_text = action_menu.at_css(".generic-table--action-menu-button .Button-label").text.strip
+ expect(header_text).to eq(life_cycle_column.caption)
+ end
+
+ context "with a life cycle stage column" do
+ let(:life_cycle_step) { create(:project_stage_definition) }
+
+ it "shows a commit icon in the header for gates" do
+ icon = action_menu.at_css(".generic-table--action-menu-button .Button-leadingVisual .octicon-git-commit")
+ expect(icon).to be_present
+
+ header_text = action_menu.at_css(".generic-table--action-menu-button .Button-label").text.strip
+ expect(header_text).to eq(life_cycle_column.caption)
+ end
+ end
end
end
end