2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-03-04 01:15:08 +08:00
discourse/spec/system/edit_category_settings_spec.rb
Krzysztof Kotlarek 1c90b0dd85
FEATURE: Allow "hot" as category default view (#37231)
Adds "hot" as an available option for category default view alongside
"latest" and "top". Administrators can now configure categories to show
the hot topics list by default when users visit the category.

<img width="659" height="228" alt="Screenshot 2026-01-21 at 9 26 26 am"
src="https://github.com/user-attachments/assets/258d1731-094e-4b51-a342-1bec55d6482c"
/>
2026-01-21 10:21:40 +08:00

34 lines
1.1 KiB
Ruby

# frozen_string_literal: true
describe "Edit Category Settings", type: :system do
fab!(:admin)
fab!(:category)
fab!(:topic) { Fabricate(:topic, category: category) }
fab!(:post) { Fabricate(:post, topic: topic) }
let(:category_page) { PageObjects::Pages::Category.new }
let(:category_default_view_select_kit) do
PageObjects::Components::SelectKit.new("#category-default-view")
end
before { sign_in(admin) }
describe "default view" do
it "allows selecting hot as the default view" do
category_page.visit_settings(category)
category_default_view_select_kit.expand
expect(category_default_view_select_kit).to have_option_value("hot")
expect(category_default_view_select_kit).to have_option_value("latest")
expect(category_default_view_select_kit).to have_option_value("top")
category_default_view_select_kit.select_row_by_value("hot")
category_page.save_settings
expect(category_default_view_select_kit.value).to eq("hot")
visit "/c/#{category.slug}/#{category.id}"
expect(page).to have_css(".navigation-container .hot.active", text: "Hot")
end
end
end