mirror of
https://github.com/opf/openproject.git
synced 2026-06-13 19:20:00 +00:00
fix: Fix rendering on double line in enumeration component
This commit is contained in:
@@ -57,15 +57,17 @@ module Admin
|
||||
def build_enumeration_menu(menu)
|
||||
edit_enumeration(menu)
|
||||
menu.with_divider
|
||||
if !first_item?
|
||||
move_to_top_enumeration(menu)
|
||||
move_up_enumeration(menu)
|
||||
if !first_item? || !last_item?
|
||||
if !first_item?
|
||||
move_to_top_enumeration(menu)
|
||||
move_up_enumeration(menu)
|
||||
end
|
||||
if !last_item?
|
||||
move_down_enumeration(menu)
|
||||
move_to_bottom_enumeration(menu)
|
||||
end
|
||||
menu.with_divider
|
||||
end
|
||||
if !last_item?
|
||||
move_down_enumeration(menu)
|
||||
move_to_bottom_enumeration(menu)
|
||||
end
|
||||
menu.with_divider
|
||||
deletion_enumeration(menu)
|
||||
end
|
||||
|
||||
|
||||
@@ -184,6 +184,26 @@ RSpec.describe "Document types admin", :js do
|
||||
end
|
||||
end
|
||||
|
||||
context "with a single document type" do
|
||||
let!(:only_type) { create(:document_type, name: "Only type") }
|
||||
|
||||
it "shows a single separator (no duplicate) in the more menu" do
|
||||
visit admin_settings_document_types_path
|
||||
|
||||
within_enumeration_item(only_type) do
|
||||
click_on accessible_name: "Document type actions"
|
||||
end
|
||||
|
||||
expect(page).to have_button("Edit")
|
||||
expect(page).to have_button("Delete")
|
||||
expect(page).to have_no_button(I18n.t(:label_sort_highest))
|
||||
expect(page).to have_no_button(I18n.t(:label_sort_higher))
|
||||
expect(page).to have_no_button(I18n.t(:label_sort_lower))
|
||||
expect(page).to have_no_button(I18n.t(:label_sort_lowest))
|
||||
expect(page).to have_css("li[role='separator']", count: 1)
|
||||
end
|
||||
end
|
||||
|
||||
context "with non-admin user" do
|
||||
current_user { create(:user) }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user