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

[#52147] provide sort helper spec

Tobias Dillmann52713081d7de
diff --git a/spec/helpers/sort_helper_spec.rb b/spec/helpers/sort_helper_spec.rb
index 5dc96b8c22a..b0afa4fd80d 100644
--- a/spec/helpers/sort_helper_spec.rb
+++ b/spec/helpers/sort_helper_spec.rb
@@ -277,7 +277,7 @@ RSpec.describe SortHelper do
%w[name id description], {}, **options)
end
- let(:options) { { param: :json } }
+ let(:options) { { param: :json, sortable: true } }
let(:sort_criteria) { SortHelper::SortCriteria.new }
let(:action_menu) do
@@ -310,6 +310,16 @@ RSpec.describe SortHelper do
expect(sort_asc["href"]).to eq("/projects?sortBy=%5B%5B%22id%22%2C%22asc%22%5D%5D")
end
+ context "with a column that is not sortable" do
+ let(:options) { { param: :json, sortable: false } }
+
+ it "does not show the sorting actions in the action-menu" do
+ expect(action_menu.at_css("action-list .ActionListItem a[data-test-selector='id-sort-desc']")).to be_nil
+
+ expect(action_menu.at_css("action-list .ActionListItem a[data-test-selector='id-sort-asc']")).to be_nil
+ end
+ end
+
it "shows an action to move columns left and right" do
move_left = action_menu.at_css("action-list .ActionListItem a[data-test-selector='id-move-col-left']")
expect(move_left.at_css(".ActionListItem-label").text.strip).to eq("Move column left")