mirror of
https://github.com/penpot/penpot.git
synced 2025-01-21 06:02:32 -05:00
Adds style-dictionary test
This commit is contained in:
parent
c6d13af071
commit
e4e488a9ee
1 changed files with 37 additions and 0 deletions
37
frontend/test/token_tests/style_dictionary_test.cljs
Normal file
37
frontend/test/token_tests/style_dictionary_test.cljs
Normal file
|
@ -0,0 +1,37 @@
|
|||
(ns token-tests.style-dictionary-test
|
||||
(:require
|
||||
[app.main.ui.workspace.tokens.style-dictionary :as sd]
|
||||
[cljs.test :as t :include-macros true]
|
||||
[promesa.core :as p]))
|
||||
|
||||
(def border-radius-token
|
||||
{:id #uuid "8c868278-7c8d-431b-bbc9-7d8f15c8edb9"
|
||||
:value "12"
|
||||
:name "borderRadius.sm"
|
||||
:type :border-radius})
|
||||
|
||||
(def reference-border-radius-token
|
||||
{:id #uuid "b9448d78-fd5b-4e3d-aa32-445904063f5b"
|
||||
:value "{borderRadius.sm} * 2"
|
||||
:name "borderRadius.md-with-dashes"
|
||||
:type :border-radius})
|
||||
|
||||
(def tokens {(:id border-radius-token) border-radius-token
|
||||
(:id reference-border-radius-token) reference-border-radius-token})
|
||||
|
||||
(t/deftest resolve-tokens-test
|
||||
(t/async
|
||||
done
|
||||
(t/testing "resolves tokens using style-dictionary"
|
||||
(-> (sd/resolve-tokens+ tokens)
|
||||
(p/finally (fn [resolved-tokens]
|
||||
(let [expected-tokens {"borderRadius.sm"
|
||||
(assoc border-radius-token
|
||||
:resolved-value 12
|
||||
:resolved-unit nil)
|
||||
"borderRadius.md-with-dashes"
|
||||
(assoc reference-border-radius-token
|
||||
:resolved-value 24
|
||||
:resolved-unit nil)}]
|
||||
(t/is (= expected-tokens resolved-tokens))
|
||||
(done))))))))
|
Loading…
Add table
Reference in a new issue