From e4239e02b710ab197a118191fd2df7eef8849541 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Wed, 28 Oct 2026 00:06:51 +0100 Subject: [PATCH] :bug: Replace conflicting fill inputs in text test edits Make named colors and explicit fills replace each other in the text notation. Raw nil, empty or nonstandard fills previously masked a new named color, making generated source color edits no-ops (F225). The notation regressions fail seven of eight assertions before the fix. Validation: notation/text suites, transitive source and frontend controls, full common JVM/JS, frontend and consumers, plus lint and formatting. Golden data and production behavior are unchanged. AI-assisted-by: GPT-6 --- common/src/app/common/test_helpers/texts.cljc | 8 ++++++-- .../common_tests/logic/text_notation_test.cljc | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/common/src/app/common/test_helpers/texts.cljc b/common/src/app/common/test_helpers/texts.cljc index 2bf5915074..079255509f 100644 --- a/common/src/app/common/test_helpers/texts.cljc +++ b/common/src/app/common/test_helpers/texts.cljc @@ -331,11 +331,15 @@ runs)) (defn restyle - "Set the run style `k` to `v` on every run of `text`." + "Set the run style `k` to `v` on every run of `text`. + Named colors and explicit fills replace each other." [text k v] (update-paragraphs text (fn [[style runs]] - [style (map (fn [[letters run-style]] [letters (assoc run-style k v)]) + [style (map (fn [[letters run-style]] + [letters (cond-> (assoc run-style k v) + (= k :color) (dissoc :fills) + (= k :fills) (dissoc :color))]) (detach-typography runs k))]))) (defn restyle-paragraphs diff --git a/common/test/common_tests/logic/text_notation_test.cljc b/common/test/common_tests/logic/text_notation_test.cljc index bdb0c0405d..23d5b5c912 100644 --- a/common/test/common_tests/logic/text_notation_test.cljc +++ b/common/test/common_tests/logic/text_notation_test.cljc @@ -16,6 +16,20 @@ (t/use-fixtures :each thi/test-fixture) +(t/deftest setting-a-named-color-replaces-explicit-fills + (doseq [fills [nil [] [{:fill-color "#123456" :fill-opacity 0.5}]]] + (let [text [[["Library text" {:fills fills :size 18}]]] + styled (thtx/restyle text :color :red)] + (t/is (= [[["Library text" {:color :red :size 18}]]] + (thtx/normalize styled))) + (t/is (= [{:fill-color "#FF0000" :fill-opacity 1}] + (get-in (thtx/content styled) [:children 0 :children 0 :children 0 :fills])))))) + +(t/deftest setting-explicit-fills-replaces-a-named-color + (let [styled (thtx/restyle [[["Library text" {:color :red :size 18}]]] :fills nil)] + (t/is (= [[["Library text" {:fills nil :size 18}]]] styled)) + (t/is (nil? (get-in (thtx/content styled) [:children 0 :children 0 :children 0 :fills]))))) + (t/deftest content-is-written-as-the-editors-write-it (let [content (thtx/content [[["Price: "] ["$10" {:weight 700 :color :red}]]]) paragraph (first (txt/node-seq txt/is-paragraph-node? content))