UX: Hide hamburger dropdown when `enable_sidebar` query param is used (#20367)

This commit is contained in:
Alan Guo Xiang Tan 2023-02-20 11:34:37 +08:00 committed by GitHub
parent f91631b625
commit d71a82786a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 5 deletions

View File

@ -339,11 +339,7 @@ createWidget("header-icons", {
},
});
if (
this.siteSettings.navigation_menu === "legacy" ||
!attrs.sidebarEnabled ||
this.site.mobileView
) {
if (!attrs.sidebarEnabled || this.site.mobileView) {
icons.push(hamburger);
}

View File

@ -7,6 +7,10 @@ module PageObjects
page.has_css?("#d-sidebar")
end
def not_visible?
page.has_no_css?("#d-sidebar")
end
def has_category_section_link?(category)
page.has_link?(category.name, class: "sidebar-section-link")
end

View File

@ -17,6 +17,22 @@ describe "Viewing sidebar", type: :system, js: true do
expect(sidebar).to be_visible
expect(sidebar).to have_category_section_link(category_sidebar_section_link.linkable)
expect(page).not_to have_css(".hamburger-dropdown")
end
end
describe "when using the sidebar navigation menu" do
before { SiteSetting.navigation_menu = "sidebar" }
it "should not display the sidebar when `enable_sidebar` query param is '0'" do
sign_in(user)
visit("/latest?enable_sidebar=0")
sidebar = PageObjects::Components::Sidebar.new
expect(sidebar).to be_not_visible
expect(page).to have_css(".hamburger-dropdown")
end
end
end