Fix can't reset custom CSS Closes #2349

This commit is contained in:
Kalle
2025-06-24 08:33:25 +03:00
parent 1abfba832e
commit cfca53773b
2 changed files with 14 additions and 6 deletions

View File

@@ -79,7 +79,13 @@ export function CustomizedColorsInput({
</summary>
<div>
<Label>{t("custom.colors.title")}</Label>
<input type="hidden" name="css" value={JSON.stringify(colorsWithDefaultsFilteredOut(colors, defaultColors))} />
<input
type="hidden"
name="css"
value={JSON.stringify(
colorsWithDefaultsFilteredOut(colors, defaultColors),
)}
/>
<div className="colors__container colors__grid">
{CUSTOM_CSS_VAR_COLORS.filter(
(cssVar) => cssVar !== "bg-lightest",
@@ -112,9 +118,9 @@ export function CustomizedColorsInput({
...colors,
};
if (cssVar === "bg-lighter") {
newColors["bg-lightest"] = defaultColors.find((color) => color["bg-lightest"])?.[
"bg-lightest"
];
newColors["bg-lightest"] = defaultColors.find(
(color) => color["bg-lightest"],
)?.["bg-lightest"];
}
setColors({
...newColors,

View File

@@ -151,8 +151,10 @@ test.describe("User page", () => {
await goToEditPage(page);
await page.locator("span").filter({ hasText: "Custom colors" }).click();
for (const button of await page.getByRole("button", { name: "Reset" }).all()) {
await button.click();
for (const button of await page
.getByRole("button", { name: "Reset" })
.all()) {
await button.click();
}
await submitEditForm(page);