mirror of
https://github.com/penpot/penpot.git
synced 2025-12-11 22:14:05 +01:00
🔧 Modify token sets by id instead of name and review usage
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
(ns frontend-tests.tokens.style-dictionary-test
|
||||
(:require
|
||||
[app.common.test-helpers.ids-map :as cthi]
|
||||
[app.common.types.tokens-lib :as ctob]
|
||||
[app.main.data.style-dictionary :as sd]
|
||||
[beicon.v2.core :as rx]
|
||||
@@ -16,22 +17,28 @@
|
||||
done
|
||||
(t/testing "resolves tokens using style-dictionary from a ids map"
|
||||
(let [tokens (-> (ctob/make-tokens-lib)
|
||||
(ctob/add-set (ctob/make-token-set :name "core"))
|
||||
(ctob/add-token-in-set "core" (ctob/make-token {:name "borderRadius.sm"
|
||||
:value "12px"
|
||||
:type :border-radius}))
|
||||
(ctob/add-token-in-set "core" (ctob/make-token {:value "{borderRadius.sm} * 2"
|
||||
:name "borderRadius.md-with-dashes"
|
||||
:type :border-radius}))
|
||||
(ctob/add-token-in-set "core" (ctob/make-token {:name "borderRadius.large"
|
||||
:value "123456789012345"
|
||||
:type :border-radius}))
|
||||
(ctob/add-token-in-set "core" (ctob/make-token {:name "borderRadius.largePx"
|
||||
:value "123456789012345px"
|
||||
:type :border-radius}))
|
||||
(ctob/add-token-in-set "core" (ctob/make-token {:name "borderRadius.largeFn"
|
||||
:value "{borderRadius.sm} * 200000000"
|
||||
:type :border-radius}))
|
||||
(ctob/add-set (ctob/make-token-set :id (cthi/new-id! :core-set)
|
||||
:name "core"))
|
||||
(ctob/add-token-in-set (cthi/id :core-set)
|
||||
(ctob/make-token {:name "borderRadius.sm"
|
||||
:value "12px"
|
||||
:type :border-radius}))
|
||||
(ctob/add-token-in-set (cthi/id :core-set)
|
||||
(ctob/make-token {:value "{borderRadius.sm} * 2"
|
||||
:name "borderRadius.md-with-dashes"
|
||||
:type :border-radius}))
|
||||
(ctob/add-token-in-set (cthi/id :core-set)
|
||||
(ctob/make-token {:name "borderRadius.large"
|
||||
:value "123456789012345"
|
||||
:type :border-radius}))
|
||||
(ctob/add-token-in-set (cthi/id :core-set)
|
||||
(ctob/make-token {:name "borderRadius.largePx"
|
||||
:value "123456789012345px"
|
||||
:type :border-radius}))
|
||||
(ctob/add-token-in-set (cthi/id :core-set)
|
||||
(ctob/make-token {:name "borderRadius.largeFn"
|
||||
:value "{borderRadius.sm} * 200000000"
|
||||
:type :border-radius}))
|
||||
(ctob/get-all-tokens))]
|
||||
(-> (sd/resolve-tokens tokens)
|
||||
(rx/sub!
|
||||
|
||||
Reference in New Issue
Block a user