FIX: change Community icons ()

Because of typo, icon could not be changed.
This commit is contained in:
Krzysztof Kotlarek 2023-06-02 11:58:54 +10:00 committed by GitHub
parent 876734bcb6
commit 20982ef875
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 2 deletions
app/assets/javascripts/discourse/app/lib/sidebar
spec/system

View File

@ -116,7 +116,7 @@ export default class CommunitySection {
sectionLinkClass,
inMoreDrawer,
link.name,
link.scon
link.icon
);
} else {
return new SectionLink(link, this, this.router);

View File

@ -197,7 +197,10 @@ describe "Custom sidebar sections", type: :system, js: true do
sign_in admin
visit("/latest")
expect(sidebar.primary_section_icons("community")).to eq(%w[layer-group user wrench ellipsis-v])
sidebar.edit_custom_section("Community")
section_modal.fill_link("Everything", "/latest", "paper-plane")
section_modal.fill_name("Edited community section")
section_modal.everything_link.drag_to(section_modal.review_link, delay: 0.4)
section_modal.save
@ -206,6 +209,9 @@ describe "Custom sidebar sections", type: :system, js: true do
expect(sidebar.primary_section_links("edited-community-section")).to eq(
["My Posts", "Everything", "Admin", "More"],
)
expect(sidebar.primary_section_icons("edited-community-section")).to eq(
%w[user paper-plane wrench ellipsis-v],
)
sidebar.edit_custom_section("Edited community section")
section_modal.reset
@ -214,6 +220,7 @@ describe "Custom sidebar sections", type: :system, js: true do
expect(sidebar.primary_section_links("community")).to eq(
["Everything", "My Posts", "Admin", "More"],
)
expect(sidebar.primary_section_icons("community")).to eq(%w[layer-group user wrench ellipsis-v])
end
it "shows anonymous public sections" do

View File

@ -67,6 +67,12 @@ module PageObjects
all("[data-section-name='#{slug}'] .sidebar-section-link-wrapper").map(&:text)
end
def primary_section_icons(slug)
all("[data-section-name='#{slug}'] .sidebar-section-link-wrapper use").map do |icon|
icon[:href].delete_prefix("#")
end
end
private
def section_link_present?(name, href: nil, active: false, present:)

View File

@ -7,9 +7,12 @@ module PageObjects
fill_in "section-name", with: name
end
def fill_link(name, url)
def fill_link(name, url, icon = "link")
fill_in "link-name", with: name, match: :first
fill_in "link-url", with: url, match: :first
find(".sidebar-section-form-link .select-kit summary", match: :first).click
fill_in "filter-input-search", with: icon, match: :first
find(".select-kit-row.is-highlighted", match: :first).click
end
def mark_as_public