Skip to content

Commit

Permalink
[#58160] provide specs for leading visual icon in action menu
Browse files Browse the repository at this point in the history
  • Loading branch information
EinLama committed Dec 13, 2024
1 parent 7490566 commit ce4688e
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion spec/helpers/sort_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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,
Expand All @@ -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

0 comments on commit ce4688e

Please sign in to comment.