mirror of
https://github.com/discourse/discourse.git
synced 2025-02-06 03:18:23 +00:00
Some sites are still on the legacy "hamburger dropdown" navigation_menu setting. In this case to avoid confusion, we want to show both the sidebar icon and the header dropdown hamburger when visiting the admin portal. Otherwise, the hamburger switches sides from right to left for admins and takes on different behaviour. The hamburger in this case _only_ shows the main panel, not other sidebar panels like the admin one.
67 lines
1.6 KiB
Ruby
67 lines
1.6 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module PageObjects
|
|
module Components
|
|
module NavigationMenu
|
|
class HeaderDropdown < Base
|
|
def open
|
|
find(".header-dropdown-toggle.hamburger-dropdown").click
|
|
self
|
|
end
|
|
|
|
def close
|
|
open
|
|
end
|
|
|
|
def has_sidebar_panel?(panel)
|
|
has_css?(
|
|
".sidebar-hamburger-dropdown .sidebar-section-wrapper[data-section-name=\"#{panel_id(panel)}\"]",
|
|
)
|
|
end
|
|
|
|
def has_no_sidebar_panel?(panel)
|
|
has_no_css?(
|
|
".sidebar-hamburger-dropdown .sidebar-section-wrapper[data-section-name=\"#{panel_id(panel)}\"]",
|
|
)
|
|
end
|
|
|
|
def has_dropdown_visible?
|
|
page.has_css?(".sidebar-hamburger-dropdown")
|
|
end
|
|
|
|
def has_no_dropdown_visible?
|
|
page.has_no_css?(".sidebar-hamburger-dropdown")
|
|
end
|
|
|
|
def visible?
|
|
page.has_css?(".hamburger-dropdown.header-dropdown-toggle")
|
|
end
|
|
|
|
def not_visible?
|
|
page.has_no_css?(".hamburger-dropdown.header-dropdown-toggle")
|
|
end
|
|
|
|
def click_customize_community_section_button
|
|
community_section.click_button(
|
|
I18n.t("js.sidebar.sections.community.edit_section.header_dropdown"),
|
|
)
|
|
|
|
expect(page).to have_no_css(".sidebar-hamburger-dropdown")
|
|
|
|
PageObjects::Modals::SidebarSectionForm.new
|
|
end
|
|
|
|
private
|
|
|
|
def panel_id(panel)
|
|
if panel == "admin"
|
|
"admin-root"
|
|
elsif panel == "main"
|
|
"community"
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|