From 0abc33c5a25a5ab3535c678e6c5e03412fdd8b8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Saquetim?= <1108771+megothss@users.noreply.github.com> Date: Wed, 19 Feb 2025 16:05:43 -0300 Subject: [PATCH] DEV: Ensure sidebar sections are collapsable in mobile view (#31383) --- .../components/sidebar/hamburger-dropdown.gjs | 9 +++----- .../tests/acceptance/sidebar-user-test.js | 21 +++++++++++++++++++ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/sidebar/hamburger-dropdown.gjs b/app/assets/javascripts/discourse/app/components/sidebar/hamburger-dropdown.gjs index 173cf21842b..10749c6a970 100644 --- a/app/assets/javascripts/discourse/app/components/sidebar/hamburger-dropdown.gjs +++ b/app/assets/javascripts/discourse/app/components/sidebar/hamburger-dropdown.gjs @@ -33,13 +33,10 @@ export default class SidebarHamburgerDropdown extends Component { } get collapsableSections() { - if ( - this.siteSettings.navigation_menu === "header dropdown" && - !this.args.collapsableSections - ) { - return this.site.mobileView || this.site.narrowDesktopView; + if (this.site.mobileView || this.site.narrowDesktopView) { + return true; } else { - this.args.collapsableSections; + return this.args.collapsableSections; } } diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-test.js index d90b09d717a..59e9ec31ac9 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-test.js @@ -77,6 +77,27 @@ acceptance( } ); +acceptance( + "Sidebar - Logged on user - Mobile view - Sidebar enabled", + function (needs) { + needs.user(); + needs.mobileView(); + + needs.settings({ + navigation_menu: "sidebar", + }); + + test("sections are collapsable", async function (assert) { + await visit("/"); + await click("#toggle-hamburger-menu"); + + assert + .dom(".sidebar-section-header.sidebar-section-header-collapsable") + .exists("sections are collapsable"); + }); + } +); + acceptance( "Sidebar - Experimental sidebar and hamburger setting enabled - Sidebar enabled", function (needs) {