mirror of
https://github.com/penpot/penpot.git
synced 2025-01-21 14:12:36 -05:00
Add predicate for all test
This commit is contained in:
parent
62ecee2cf8
commit
e75f9a7c7f
2 changed files with 6 additions and 0 deletions
|
@ -59,6 +59,11 @@
|
||||||
acc applied-attrs))))
|
acc applied-attrs))))
|
||||||
{} shapes))
|
{} shapes))
|
||||||
|
|
||||||
|
(defn group-shapes-by-all-applied-all? [grouped-shapes]
|
||||||
|
(and (seq (:all grouped-shapes))
|
||||||
|
(empty? (:other grouped-shapes))
|
||||||
|
(empty? (:some grouped-shapes))))
|
||||||
|
|
||||||
(defn token-name->path
|
(defn token-name->path
|
||||||
"Splits token-name into a path vector split by `.` characters.
|
"Splits token-name into a path vector split by `.` characters.
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
(let [shapes [{:applied-tokens {:x 1 :y 1}}
|
(let [shapes [{:applied-tokens {:x 1 :y 1}}
|
||||||
{:applied-tokens {:x 1 :y 1}}]
|
{:applied-tokens {:x 1 :y 1}}]
|
||||||
expected (wtt/group-shapes-by-all-applied {:id 1} shapes #{:x :y})]
|
expected (wtt/group-shapes-by-all-applied {:id 1} shapes #{:x :y})]
|
||||||
|
(t/is (true? (wtt/group-shapes-by-all-applied-all? expected)))
|
||||||
(t/is (= (:all expected) shapes))
|
(t/is (= (:all expected) shapes))
|
||||||
(t/is (empty? (:other expected)))
|
(t/is (empty? (:other expected)))
|
||||||
(t/is (empty? (:some expected)))))
|
(t/is (empty? (:some expected)))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue