🐛 Fix font-family being split up when restoring from backup value

This commit is contained in:
Florian Schroedl
2025-09-11 10:00:25 +02:00
committed by Andrés Moya
parent 2d68f4dfd3
commit 61cfe2d142
2 changed files with 11 additions and 4 deletions

View File

@@ -960,6 +960,12 @@ test.describe("Tokens: Themes modal", () => {
name: /save/i,
});
// Fill font-family to verify to verify that input value doesn't get split into list of characters
const fontFamilyField = tokensUpdateCreateModal
.getByLabel("Font family")
.first();
await fontFamilyField.fill("OneWord");
// Invalidate incorrect values for font size
const fontSizeField = tokensUpdateCreateModal.getByLabel(/Font Size/i);
await fontSizeField.fill("invalid");
@@ -975,9 +981,6 @@ test.describe("Tokens: Themes modal", () => {
// Fill in values for all fields and verify they persist when switching tabs
await fontSizeField.fill("16");
const fontFamilyField = tokensUpdateCreateModal
.getByLabel(/Font Family/i)
.first();
const fontWeightField =
tokensUpdateCreateModal.getByLabel(/Font Weight/i);
const letterSpacingField =

View File

@@ -1024,7 +1024,11 @@ custom-input-token-value-props: Custom props passed to the custom-input-token-va
(fn [e]
(if reference-tab-active?
(swap! backup-state-ref assoc :reference (dom/get-target-val e))
(swap! backup-state-ref assoc-in [:composite (obj/get e "tokenType")] (dom/get-target-val e)))
(let [token-type (obj/get e "tokenType")
token-value (dom/get-target-val e)
token-value (cond-> token-value
(= :font-family token-type) (ctt/split-font-family))]
(swap! backup-state-ref assoc-in [:composite token-type] token-value)))
(on-update-value e)))
input-props (mf/spread-props props {:default-value default-value