From ce4688e09d5ae56a034fb1838e7ebd767ce91ac6 Mon Sep 17 00:00:00 2001 From: Tobias Dillmann Date: Fri, 13 Dec 2024 10:39:19 +0100 Subject: [PATCH] [#58160] provide specs for leading visual icon in action menu --- spec/helpers/sort_helper_spec.rb | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/spec/helpers/sort_helper_spec.rb b/spec/helpers/sort_helper_spec.rb index 5b5dec2210c6..149da1f15bab 100644 --- a/spec/helpers/sort_helper_spec.rb +++ b/spec/helpers/sort_helper_spec.rb @@ -310,6 +310,10 @@ def session; @session ||= {}; end 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 @@ def session; @session ||= {}; end 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 @@ def session; @session ||= {}; end 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