A platform for community discussion. Free, open, simple.
FIX: Apply dark-only wizard palettes in both system color modes (#45394)
Penar Musaraj45912f91e59b
diff --git a/frontend/discourse/app/services/design-wizard.js b/frontend/discourse/app/services/design-wizard.jsindex 57273d3eceb..2c17adf3cd0 100644--- a/frontend/discourse/app/services/design-wizard.js+++ b/frontend/discourse/app/services/design-wizard.js@@ -149,7 +149,8 @@ export default class DesignWizardService extends Service {get #selectionsPayload() {return {theme_id: this.themeId,- light_palette_id: this.selectedPair?.light?.id,+ light_palette_id:+ this.selectedPair?.light?.id ?? this.selectedPair?.dark?.id,dark_palette_id: this.selectedPair?.dark?.id,palettes_user_selectable: this.palettesUserSelectable,base_font: this.bodyFont,diff --git a/frontend/discourse/tests/acceptance/design-wizard-test.gjs b/frontend/discourse/tests/acceptance/design-wizard-test.gjsindex 42fd373edee..7aeaa8ec99e 100644--- a/frontend/discourse/tests/acceptance/design-wizard-test.gjs+++ b/frontend/discourse/tests/acceptance/design-wizard-test.gjs@@ -117,6 +117,52 @@ acceptance("Design wizard - admin launch", function (needs) {);});+ test("saves a dark-only palette for both system color modes", async function (assert) {+ wizardData.themes[0].palette_pairs.push({+ key: "dracula",+ name: "Dracula",+ dark_only: true,+ light: null,+ dark: {+ id: -11,+ name: "Dracula",+ colors: { primary: "f8f8f2", secondary: "282a36" },+ },+ });+ sinon.stub(DiscourseURL, "redirectTo");++ await visit("/admin");+ await click(APPEARANCE_LAUNCH_BUTTON);+ await click(".design-wizard__intro-start");+ await click(".design-wizard__next");+ await click('[data-pair-key="dracula"]');+ await click(".design-wizard__next");++ assert.strictEqual(+ savedPayloads.at(-1).light_palette_id,+ "-11",+ "progress saves Dracula as the default palette for light systems"+ );+ assert.strictEqual(+ savedPayloads.at(-1).dark_palette_id,+ "-11",+ "progress saves Dracula for dark systems"+ );++ await click(".design-wizard__save");++ assert.strictEqual(+ savedPayloads.at(-1).light_palette_id,+ "-11",+ "the final save keeps Dracula as the default palette"+ );+ assert.strictEqual(+ savedPayloads.at(-1).dark_palette_id,+ "-11",+ "the final save keeps Dracula for dark systems"+ );+ });+test("installs a remote theme before navigating to its preview", async function (assert) {const remoteUrl = "https://github.com/discourse/discourse-concord-theme";wizardData.themes.push({