From e992bf0aa6bf4f61ac30b7f8e4d6cd9f99e5f29d Mon Sep 17 00:00:00 2001 From: Florian Schroedl Date: Thu, 8 Aug 2024 15:13:04 +0200 Subject: [PATCH] Fix sizing test --- .../token_tests/logic/token_actions_test.cljs | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/frontend/test/token_tests/logic/token_actions_test.cljs b/frontend/test/token_tests/logic/token_actions_test.cljs index 17c16bece..e0d3fac38 100644 --- a/frontend/test/token_tests/logic/token_actions_test.cljs +++ b/frontend/test/token_tests/logic/token_actions_test.cljs @@ -147,33 +147,33 @@ (t/is (= (:width rect-1') 100)) (t/is (= (:height rect-1') 100)))))))))) -;; (t/deftest test-apply-sizing -;; (t/testing "applies sizing token and updates the shapes width and height" -;; (t/async -;; done -;; (let [file (-> (setup-file) -;; (toht/add-token :token-target {:value "100" -;; :name "sizing.sm" -;; :type :sizing})) -;; store (ths/setup-store file) -;; rect-1 (cths/get-shape file :rect-1) -;; events [(wtch/apply-token {:shape-ids [(:id rect-1)] -;; :attributes #{:width :height} -;; :token (toht/get-token file :token-target) -;; :on-update-shape wtch/update-shape-dimensions})]] -;; (tohs/run-store-async -;; store done events -;; (fn [new-state] -;; (let [file' (ths/get-file-from-store new-state) -;; token-target' (toht/get-token file' :token-target) -;; rect-1' (cths/get-shape file' :rect-1)] -;; (t/testing "shape `:applied-tokens` got updated" -;; (t/is (some? (:applied-tokens rect-1'))) -;; (t/is (= (:width (:applied-tokens rect-1')) (wtt/token-identifier token-target'))) -;; (t/is (= (:height (:applied-tokens rect-1')) (wtt/token-identifier token-target')))) -;; (t/testing "shapes width and height got updated" -;; (t/is (= (:width rect-1') 100)) -;; (t/is (= (:height rect-1') 100)))))))))) +(t/deftest test-apply-sizing + (t/testing "applies sizing token and updates the shapes width and height" + (t/async + done + (let [file (-> (setup-file) + (toht/add-token :token-target {:value "100" + :name "sizing.sm" + :type :sizing})) + store (ths/setup-store file) + rect-1 (cths/get-shape file :rect-1) + events [(wtch/apply-token {:shape-ids [(:id rect-1)] + :attributes #{:width :height} + :token (toht/get-token file :token-target) + :on-update-shape wtch/update-shape-dimensions})]] + (tohs/run-store-async + store done events + (fn [new-state] + (let [file' (ths/get-file-from-store new-state) + token-target' (toht/get-token file' :token-target) + rect-1' (cths/get-shape file' :rect-1)] + (t/testing "shape `:applied-tokens` got updated" + (t/is (some? (:applied-tokens rect-1'))) + (t/is (= (:width (:applied-tokens rect-1')) (wtt/token-identifier token-target'))) + (t/is (= (:height (:applied-tokens rect-1')) (wtt/token-identifier token-target')))) + (t/testing "shapes width and height got updated" + (t/is (= (:width rect-1') 100)) + (t/is (= (:height rect-1') 100)))))))))) (t/deftest test-apply-opacity (t/testing "applies opacity token and updates the shapes opacity"