discourse/spec/system/viewing_navigation_menu_preferences_spec.rb
Osama Sayegh b27e12445d
FEATURE: Split navigation preference for count and behavior of sidebar links (#22203)
This PR splits up the preference that controls the count vs dot and destination of sidebar links, which is really hard to understand, into 2 simpler checkboxes:

The new preferences/checkboxes are off by default, but there are database migrations to switch the old preference to the new ones so that existing users don't have to update their preferences to keep their preferred behavior of sidebar links when this changed is rolled out.

Internal topic: t/103529.
2023-06-22 19:04:13 +03:00

57 lines
1.9 KiB
Ruby

# frozen_string_literal: true
describe "Viewing sidebar preferences", type: :system do
let(:user_preferences_navigation_menu_page) do
PageObjects::Pages::UserPreferencesNavigationMenu.new
end
before { SiteSetting.navigation_menu = "sidebar" }
context "as an admin" do
fab!(:admin) { Fabricate(:admin) }
fab!(:user) { Fabricate(:user) }
fab!(:category) { Fabricate(:category) }
fab!(:category2) { Fabricate(:category) }
fab!(:category_sidebar_section_link) do
Fabricate(:category_sidebar_section_link, user: user, linkable: category)
end
fab!(:category2_sidebar_section_link) do
Fabricate(:category_sidebar_section_link, user: user, linkable: category2)
end
fab!(:tag) { Fabricate(:tag) }
fab!(:tag2) { Fabricate(:tag) }
fab!(:tag_sidebar_section_link) do
Fabricate(:tag_sidebar_section_link, user: user, linkable: tag)
end
fab!(:tag2_sidebar_section_link) do
Fabricate(:tag_sidebar_section_link, user: user, linkable: tag2)
end
before { sign_in(admin) }
it "should be able to view navigation menu preferences of another user" do
user.user_option.update!(
sidebar_link_to_filtered_list: true,
sidebar_show_count_of_new_items: true,
)
user_preferences_navigation_menu_page.visit(user)
expect(user_preferences_navigation_menu_page).to have_navigation_menu_categories_preference(
category,
category2,
)
expect(user_preferences_navigation_menu_page).to have_navigation_menu_tags_preference(
tag,
tag2,
)
expect(user_preferences_navigation_menu_page).to have_navigation_menu_preference_checked(
"pref-show-count-new-items",
)
expect(user_preferences_navigation_menu_page).to have_navigation_menu_preference_checked(
"pref-link-to-filtered-list",
)
end
end
end