FIX: Allow hot selection to actually work in wizard

This commit is contained in:
Martin Brennan 2024-12-13 17:28:08 +10:00
parent 7e530f6c05
commit 2958e093b2
No known key found for this signature in database
GPG Key ID: BD981EFEEC8F5675
2 changed files with 9 additions and 8 deletions

View File

@ -191,10 +191,10 @@ class Wizard
current =
(
if SiteSetting.top_menu_map.first == "categories"
if SiteSetting.homepage == "categories"
SiteSetting.desktop_category_page_style
else
"latest"
SiteSetting.homepage
end
)
style =
@ -219,9 +219,10 @@ class Wizard
updater.update_setting(:heading_font, updater.fields[:heading_font])
top_menu = SiteSetting.top_menu_map
if updater.fields[:homepage_style] == "latest" && top_menu.first != "latest"
top_menu.delete("latest")
top_menu.insert(0, "latest")
if %w[latest hot].include?(updater.fields[:homepage_style]) &&
top_menu.first != updater.fields[:homepage_style]
top_menu.delete(updater.fields[:homepage_style])
top_menu.insert(0, updater.fields[:homepage_style])
elsif updater.fields[:homepage_style] != "latest"
top_menu.delete("categories")
top_menu.insert(0, "categories")

View File

@ -70,7 +70,7 @@ describe "Wizard", type: :system do
wizard_page.styling_step.select_color_palette_option("Dark")
wizard_page.styling_step.select_body_font_option("lato")
wizard_page.styling_step.select_heading_font_option("merriweather")
wizard_page.styling_step.select_homepage_style_option("categories_only")
wizard_page.styling_step.select_homepage_style_option("hot")
wizard_page.go_to_next_step
expect(wizard_page).to be_on_step("ready")
@ -80,14 +80,14 @@ describe "Wizard", type: :system do
)
expect(SiteSetting.base_font).to eq("lato")
expect(SiteSetting.heading_font).to eq("merriweather")
expect(SiteSetting.homepage).to eq("categories")
expect(SiteSetting.homepage).to eq("hot")
wizard_page.go_to_step("styling")
expect(wizard_page.styling_step).to have_selected_color_palette("Dark")
expect(wizard_page.styling_step).to have_selected_body_font("lato")
expect(wizard_page.styling_step).to have_selected_heading_font("merriweather")
expect(wizard_page.styling_step).to have_selected_homepage_style("categories_only")
expect(wizard_page.styling_step).to have_selected_homepage_style("hot")
end
end