mirror of
https://github.com/penpot/penpot.git
synced 2025-06-05 13:41:39 +02:00
Add function to check if a token can be placed under a name path
This commit is contained in:
parent
48a7c52664
commit
174d91a519
3 changed files with 53 additions and 5 deletions
|
@ -14,7 +14,7 @@
|
|||
(t/is (= ["foo" "bar" "baz"] (wtt/token-name->path "foo..bar.baz")))
|
||||
(t/is (= ["foo" "bar" "baz"] (wtt/token-name->path "foo..bar.baz...."))))
|
||||
|
||||
(t/deftest tokens-name-tree
|
||||
(t/deftest tokens-name-tree-test
|
||||
(t/is (= {"foo"
|
||||
{"bar"
|
||||
{"baz" {:name "foo.bar.baz", :value "a"},
|
||||
|
@ -26,3 +26,10 @@
|
|||
:value "b"}
|
||||
:c {:name "baz.bar.foo"
|
||||
:value "{foo.bar.baz}"}}))))
|
||||
|
||||
(t/deftest token-name-path-exists?-test
|
||||
(t/is (true? (wtt/token-name-path-exists? "border-radius" {"border-radius" {:name "sm"}})))
|
||||
(t/is (true? (wtt/token-name-path-exists? "border-radius.sm" {"border-radius" {:name "sm"}})))
|
||||
(t/is (true? (wtt/token-name-path-exists? "border-radius.sm.x" {"border-radius" {:name "sm"}})))
|
||||
(t/is (false? (wtt/token-name-path-exists? "other" {"border-radius" {:name "sm"}})))
|
||||
(t/is (false? (wtt/token-name-path-exists? "dark.border-radius.md" {"dark" {"border-radius" {"sm" {:name "sm"}}}}))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue