FIX: light color scheme picker should default to user selection (#12913)

Fixes a bug in user preferences > interface, the light scheme dropdown
was defaulting to "Theme Default" even when the user had selected a
different scheme.
This commit is contained in:
Penar Musaraj 2021-04-30 11:31:01 -04:00 committed by GitHub
parent 4f36f604c8
commit 28cefb666a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 3 deletions

View File

@ -237,9 +237,7 @@ export default Controller.extend({
return value;
},
get() {
return this.currentSchemeCanBeSelected
? this.session.userColorSchemeId
: null;
return this.session.userColorSchemeId;
},
}),

View File

@ -176,6 +176,21 @@ acceptance(
);
});
test("light color scheme defaults to custom scheme selected by user", async function (assert) {
let site = Site.current();
let session = Session.current();
session.userColorSchemeId = 2;
site.set("user_color_schemes", [{ id: 2, name: "Cool Breeze" }]);
await visit("/u/eviltrout/preferences/interface");
assert.ok(exists(".light-color-scheme"), "has light scheme dropdown");
assert.equal(
queryAll(".light-color-scheme .selected-name").data("value"),
session.userColorSchemeId,
"user's selected color scheme is selected value in light scheme dropdown"
);
});
test("light and dark color scheme pickers", async function (assert) {
let site = Site.current();
let session = Session.current();