2023-01-12 17:47:58 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-06-06 21:26:58 -04:00
|
|
|
describe "Viewing sidebar", type: :system do
|
2023-01-12 17:47:58 -05:00
|
|
|
fab!(:admin) { Fabricate(:admin) }
|
|
|
|
fab!(:user) { Fabricate(:user) }
|
|
|
|
fab!(:category_sidebar_section_link) { Fabricate(:category_sidebar_section_link, user: user) }
|
|
|
|
|
2023-03-09 23:54:57 -05:00
|
|
|
before { sign_in(user) }
|
2023-02-20 20:59:56 -05:00
|
|
|
|
2023-01-12 17:47:58 -05:00
|
|
|
describe "when using the legacy navigation menu" do
|
|
|
|
before { SiteSetting.navigation_menu = "legacy" }
|
|
|
|
|
2023-02-20 20:59:56 -05:00
|
|
|
it "should display the sidebar when `navigation_menu` query param is 'sidebar'" do
|
|
|
|
visit("/latest?navigation_menu=sidebar")
|
2023-01-12 17:47:58 -05:00
|
|
|
|
|
|
|
sidebar = PageObjects::Components::Sidebar.new
|
|
|
|
|
|
|
|
expect(sidebar).to be_visible
|
|
|
|
expect(sidebar).to have_category_section_link(category_sidebar_section_link.linkable)
|
2023-02-19 22:34:37 -05:00
|
|
|
expect(page).not_to have_css(".hamburger-dropdown")
|
|
|
|
end
|
2023-02-20 20:59:56 -05:00
|
|
|
|
|
|
|
it "should display the sidebar dropdown menu when `navigation_menu` query param is 'header_dropdown'" do
|
|
|
|
visit("/latest?navigation_menu=header_dropdown")
|
|
|
|
|
|
|
|
sidebar = PageObjects::Components::Sidebar.new
|
|
|
|
|
|
|
|
expect(sidebar).to be_not_visible
|
|
|
|
|
|
|
|
header_dropdown = PageObjects::Components::SidebarHeaderDropdown.new
|
|
|
|
header_dropdown.click
|
|
|
|
|
|
|
|
expect(header_dropdown).to be_visible
|
|
|
|
end
|
2023-02-19 22:34:37 -05:00
|
|
|
end
|
|
|
|
|
2023-02-21 17:43:14 -05:00
|
|
|
describe "when using the header dropdown navigation menu" do
|
|
|
|
before { SiteSetting.navigation_menu = "header dropdown" }
|
|
|
|
|
|
|
|
it "should display the sidebar when `navigation_menu` query param is 'sidebar'" do
|
|
|
|
visit("/latest?navigation_menu=sidebar")
|
|
|
|
|
|
|
|
sidebar = PageObjects::Components::Sidebar.new
|
|
|
|
|
|
|
|
expect(sidebar).to be_visible
|
|
|
|
expect(page).not_to have_css(".hamburger-dropdown")
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should display the legacy dropdown menu when `navigation_menu` query param is 'legacy'" do
|
|
|
|
visit("/latest?navigation_menu=legacy")
|
|
|
|
|
|
|
|
sidebar = PageObjects::Components::Sidebar.new
|
|
|
|
|
|
|
|
expect(sidebar).to be_not_visible
|
|
|
|
|
|
|
|
legacy_header_dropdown = PageObjects::Components::LegacyHeaderDropdown.new
|
|
|
|
legacy_header_dropdown.click
|
|
|
|
|
|
|
|
expect(legacy_header_dropdown).to be_visible
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-02-19 22:34:37 -05:00
|
|
|
describe "when using the sidebar navigation menu" do
|
|
|
|
before { SiteSetting.navigation_menu = "sidebar" }
|
|
|
|
|
2023-02-20 20:59:56 -05:00
|
|
|
it "should display the legacy dropdown menu when `navigation_menu` query param is 'legacy'" do
|
|
|
|
visit("/latest?navigation_menu=legacy")
|
2023-02-19 22:34:37 -05:00
|
|
|
|
2023-02-20 20:59:56 -05:00
|
|
|
sidebar = PageObjects::Components::Sidebar.new
|
|
|
|
|
|
|
|
expect(sidebar).to be_not_visible
|
|
|
|
|
|
|
|
legacy_header_dropdown = PageObjects::Components::LegacyHeaderDropdown.new
|
|
|
|
legacy_header_dropdown.click
|
|
|
|
|
|
|
|
expect(legacy_header_dropdown).to be_visible
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should display the sidebar dropdown menu when `navigation_menu` query param is 'header_dropdown'" do
|
|
|
|
visit("/latest?navigation_menu=header_dropdown")
|
2023-02-19 22:34:37 -05:00
|
|
|
|
|
|
|
sidebar = PageObjects::Components::Sidebar.new
|
|
|
|
|
|
|
|
expect(sidebar).to be_not_visible
|
2023-02-20 20:59:56 -05:00
|
|
|
|
|
|
|
header_dropdown = PageObjects::Components::SidebarHeaderDropdown.new
|
|
|
|
header_dropdown.click
|
|
|
|
|
|
|
|
expect(header_dropdown).to be_visible
|
2023-01-12 17:47:58 -05:00
|
|
|
end
|
|
|
|
end
|
2023-06-19 03:51:33 -04:00
|
|
|
|
|
|
|
describe "Community sidebar section", type: :system do
|
|
|
|
fab!(:user) { Fabricate(:user, locale: "pl_PL") }
|
|
|
|
fab!(:translation_override) do
|
|
|
|
TranslationOverride.create!(
|
|
|
|
locale: "pl_PL",
|
|
|
|
translation_key: "js.sidebar.sections.community.links.topics.content",
|
|
|
|
value: "Tematy",
|
|
|
|
)
|
|
|
|
TranslationOverride.create!(
|
|
|
|
locale: "pl_PL",
|
|
|
|
translation_key: "js.sidebar.sections.community.links.topics.title",
|
|
|
|
value: "Wszystkie tematy",
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
before { SiteSetting.allow_user_locale = true }
|
|
|
|
|
|
|
|
it "has correct translations" do
|
|
|
|
sign_in user
|
|
|
|
visit("/latest")
|
|
|
|
links = page.all("#sidebar-section-content-community .sidebar-section-link-wrapper a")
|
|
|
|
expect(links.map(&:text)).to eq(%w[Tematy Wysłane])
|
|
|
|
expect(links.map { |link| link[:title] }).to eq(
|
|
|
|
["Wszystkie tematy", "Moja ostatnia aktywność w temacie"],
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
2023-01-12 17:47:58 -05:00
|
|
|
end
|