diff --git a/app/assets/javascripts/discourse/app/lib/sidebar/community-section.js b/app/assets/javascripts/discourse/app/lib/sidebar/community-section.js index 20fae4dba05..0f12705106d 100644 --- a/app/assets/javascripts/discourse/app/lib/sidebar/community-section.js +++ b/app/assets/javascripts/discourse/app/lib/sidebar/community-section.js @@ -116,7 +116,7 @@ export default class CommunitySection { sectionLinkClass, inMoreDrawer, link.name, - link.scon + link.icon ); } else { return new SectionLink(link, this, this.router); diff --git a/spec/system/custom_sidebar_sections_spec.rb b/spec/system/custom_sidebar_sections_spec.rb index b2f5356e12b..3875f320a4a 100644 --- a/spec/system/custom_sidebar_sections_spec.rb +++ b/spec/system/custom_sidebar_sections_spec.rb @@ -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 diff --git a/spec/system/page_objects/components/sidebar.rb b/spec/system/page_objects/components/sidebar.rb index a8b944ba8ef..2349d48141d 100644 --- a/spec/system/page_objects/components/sidebar.rb +++ b/spec/system/page_objects/components/sidebar.rb @@ -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:) diff --git a/spec/system/page_objects/modals/sidebar_section_form.rb b/spec/system/page_objects/modals/sidebar_section_form.rb index 37100fd5a07..800f7827217 100644 --- a/spec/system/page_objects/modals/sidebar_section_form.rb +++ b/spec/system/page_objects/modals/sidebar_section_form.rb @@ -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