mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
FEATURE: ability to reorder links in custom sidebar sections (#20626)
Drag and drop to reorder custom sidebar sections
This commit is contained in:

committed by
GitHub

parent
53cadac4b8
commit
db74e9484b
@ -80,6 +80,33 @@ describe "Custom sidebar sections", type: :system, js: true do
|
||||
expect(page).not_to have_link("Sidebar Categories")
|
||||
end
|
||||
|
||||
it "allows the user to reorder links in custom section" do
|
||||
sidebar_section = Fabricate(:sidebar_section, title: "My section", user: user)
|
||||
sidebar_url_1 = Fabricate(:sidebar_url, name: "Sidebar Tags", value: "/tags")
|
||||
Fabricate(:sidebar_section_link, sidebar_section: sidebar_section, linkable: sidebar_url_1)
|
||||
sidebar_url_2 = Fabricate(:sidebar_url, name: "Sidebar Categories", value: "/categories")
|
||||
Fabricate(:sidebar_section_link, sidebar_section: sidebar_section, linkable: sidebar_url_2)
|
||||
|
||||
visit("/latest")
|
||||
within(".sidebar-custom-sections .sidebar-section-link-wrapper:nth-child(1)") do
|
||||
expect(page).to have_css(".sidebar-section-link-sidebar-tags")
|
||||
end
|
||||
within(".sidebar-custom-sections .sidebar-section-link-wrapper:nth-child(2)") do
|
||||
expect(page).to have_css(".sidebar-section-link-sidebar-categories")
|
||||
end
|
||||
|
||||
tags_link = find(".sidebar-section-link-sidebar-tags")
|
||||
categories_link = find(".sidebar-section-link-sidebar-categories")
|
||||
tags_link.drag_to(categories_link)
|
||||
|
||||
within(".sidebar-custom-sections .sidebar-section-link-wrapper:nth-child(1)") do
|
||||
expect(page).to have_css(".sidebar-section-link-sidebar-categories")
|
||||
end
|
||||
within(".sidebar-custom-sections .sidebar-section-link-wrapper:nth-child(2)") do
|
||||
expect(page).to have_css(".sidebar-section-link-sidebar-tags")
|
||||
end
|
||||
end
|
||||
|
||||
it "does not allow the user to edit public section" do
|
||||
sidebar_section = Fabricate(:sidebar_section, title: "Public section", user: user, public: true)
|
||||
sidebar_url_1 = Fabricate(:sidebar_url, name: "Sidebar Tags", value: "/tags")
|
||||
|
Reference in New Issue
Block a user