mirror of
https://github.com/penpot/penpot.git
synced 2026-03-27 13:50:26 +01:00
Updates
This commit is contained in:
@@ -363,6 +363,8 @@
|
||||
(update-token-in-set [_ set-name token-name f] "update a token in a set")
|
||||
(delete-token-from-set [_ set-name token-name] "delete a token from a set")
|
||||
(toggle-set-in-theme [_ group-name theme-name set-name] "toggle a set used / not used in a theme")
|
||||
(get-active-themes-set-names [_] "set of set names that are active in the the active themes")
|
||||
(get-active-themes-set-tokens [_] "set of set names that are active in the the active themes")
|
||||
(validate [_]))
|
||||
|
||||
(deftype TokensLib [sets set-groups themes active-themes]
|
||||
@@ -571,6 +573,21 @@
|
||||
active-themes)
|
||||
this))
|
||||
|
||||
(get-active-themes-set-names [this]
|
||||
(into #{}
|
||||
(mapcat :sets)
|
||||
(get-active-themes this)))
|
||||
|
||||
(get-active-themes-set-tokens [this]
|
||||
(mapcat (fn [x]
|
||||
(->> (get x :sets)
|
||||
(map (fn [y]
|
||||
(->
|
||||
(get-set this y)
|
||||
:tokens)))))
|
||||
(get-active-themes this)))
|
||||
|
||||
|
||||
(validate [_]
|
||||
(and (valid-token-sets? sets) ;; TODO: validate set-groups
|
||||
(valid-token-themes? themes)
|
||||
|
||||
@@ -182,6 +182,19 @@
|
||||
(t/is (dt/is-after? (:modified-at token-set') (:modified-at token-set)))))
|
||||
|
||||
(t/deftest delete-token-set
|
||||
(let [tokens-lib (-> (ctob/make-tokens-lib)
|
||||
(ctob/add-set (ctob/make-token-set :name "test-token-set")))
|
||||
|
||||
tokens-lib' (-> tokens-lib
|
||||
(ctob/delete-set "test-token-set")
|
||||
(ctob/delete-set "not-existing-set"))
|
||||
|
||||
token-set' (ctob/get-set tokens-lib' "updated-name")]
|
||||
|
||||
(t/is (= (ctob/set-count tokens-lib') 0))
|
||||
(t/is (nil? token-set'))))
|
||||
|
||||
(t/deftest active-themes-set-names
|
||||
(let [tokens-lib (-> (ctob/make-tokens-lib)
|
||||
(ctob/add-set (ctob/make-token-set :name "test-token-set")))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user