Restore apply-tokens test

This commit is contained in:
Florian Schroedl 2024-10-02 16:57:20 +02:00
parent eceffda095
commit 1df40ea07a
3 changed files with 39 additions and 35 deletions

View file

@ -1,5 +1,6 @@
(ns token-tests.helpers.state
(:require
[app.common.types.tokens-lib :as ctob]
[app.main.ui.workspace.tokens.style-dictionary :as sd]
[beicon.v2.core :as rx]
[potok.v2.core :as ptk]))
@ -21,11 +22,10 @@
(ptk/reify ::end+
ptk/WatchEvent
(watch [_ state _]
(->> (rx/from (sd/resolve-tokens+ (get-in state [:workspace-data :tokens])))
(rx/mapcat
(fn [_]
(rx/of
(end))))))))
(->> (rx/from (-> (get-in state [:workspace-data :tokens-lib])
(ctob/get-active-themes-set-tokens)
(sd/resolve-tokens+ {:names-map? true})))
(rx/mapcat #(rx/of (end)))))))
(defn stop-on
"Helper function to be used with async version of run-store.

View file

@ -10,7 +10,7 @@
(update-in state [:data :tokens] assoc id token)))
(defn get-token [file name]
(some-> (get-in file [:data :tokens-li])
(some-> (get-in file [:data :tokens-lib])
(ctob/get-active-themes-set-tokens)
(get name)))