0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-20 13:42:59 -05:00

🐛 Fix missing active sets in set groups showing partial selection

This commit is contained in:
Florian Schroedl 2024-12-10 14:04:32 +01:00
parent 5ff3469da7
commit aa292e4829
2 changed files with 13 additions and 6 deletions

View file

@ -882,9 +882,10 @@ Will return a value that matches this schema:
(map :name)
(into #{}))
difference (set/difference path-active-set-names active-set-names)]
(if (empty? difference)
:all
:partial))
(cond
(empty? difference) :all
(seq (set/intersection path-active-set-names active-set-names)) :partial
:else :none))
:none)))
(get-active-themes-set-tokens [this]

View file

@ -412,7 +412,9 @@
:sets #{"foo/bar/baz"}))
(ctob/add-theme (ctob/make-token-theme :name "all"
:sets #{"foo/bar/baz"
"foo/bar/bam"})))
"foo/bar/bam"}))
(ctob/add-theme (ctob/make-token-theme :name "invalid"
:sets #{"foo/missing"})))
expected-none (-> tokens-lib
(ctob/set-active-themes #{"/none"})
@ -422,10 +424,14 @@
(ctob/sets-at-path-all-active? "G-foo"))
expected-partial (-> tokens-lib
(ctob/set-active-themes #{"/partial"})
(ctob/sets-at-path-all-active? "G-foo"))
expected-invalid-none (-> tokens-lib
(ctob/set-active-themes #{"/invalid"})
(ctob/sets-at-path-all-active? "G-foo"))]
(t/is (= :none expected-none))
(t/is (= :all expected-all))
(t/is (= :partial expected-partial)))))
(t/is (= :partial expected-partial))
(t/is (= :none expected-invalid-none)))))
(t/deftest token-theme-in-a-lib
(t/testing "add-token-theme"