diff --git a/common/test/common_tests/types/tokens_lib_test.cljc b/common/test/common_tests/types/tokens_lib_test.cljc index 8c4d9f469..75fcea2c8 100644 --- a/common/test/common_tests/types/tokens_lib_test.cljc +++ b/common/test/common_tests/types/tokens_lib_test.cljc @@ -405,54 +405,6 @@ (t/is (dt/is-after? (:modified-at token-theme') (:modified-at token-theme)))))) -(t/testing "theme activation in a lib" - (t/deftest get-theme-collections - (let [tokens-lib (-> (ctob/make-tokens-lib) - (ctob/add-theme (ctob/make-token-theme :group "" :name "other-theme")) - (ctob/add-theme (ctob/make-token-theme :group "" :name "theme-1")) - (ctob/activate-theme "" "theme-1") - (ctob/add-theme (ctob/make-token-theme :group "group-1" :name "theme-2")) - (ctob/activate-theme "group-1" "theme-2")) - expected-active-themes (->> (ctob/get-active-themes tokens-lib) - (map #(select-keys % [:name :group])))] - - (t/is (= #{"/theme-1" "group-1/theme-2"} - (ctob/get-active-theme-paths tokens-lib)) - "should be set of active theme paths") - - (t/is (= (list {:group "group-1" :name "theme-2"} {:group "" :name "theme-1"}) - expected-active-themes)))) - - (t/deftest toggle-theme-activity-in-group - (let [tokens-lib (-> (ctob/make-tokens-lib) - (ctob/add-theme (ctob/make-token-theme :group "group-1" :name "theme-1")) - (ctob/add-theme (ctob/make-token-theme :group "group-1" :name "theme-2"))) - - tokens-lib' (-> tokens-lib - (ctob/activate-theme "group-1" "theme-1") - (ctob/activate-theme "group-1" "theme-2"))] - - (t/is (not (ctob/theme-active? tokens-lib' "group-1" "theme-1")) "theme-1 should be de-activated") - (t/is (ctob/theme-active? tokens-lib' "group-1" "theme-2") "theme-1 should be activated"))) - - (t/deftest toggle-theme-activity - (let [tokens-lib (-> (ctob/make-tokens-lib) - (ctob/add-theme (ctob/make-token-theme :group "group-1" :name "theme-1")) - (ctob/toggle-theme-active? "group-1" "theme-1")) - - tokens-lib' (-> tokens-lib - (ctob/toggle-theme-active? "group-1" "theme-1"))] - - (t/is (ctob/theme-active? tokens-lib "group-1" "theme-1") "theme-1 should be activated") - (t/is (not (ctob/theme-active? tokens-lib' "group-1" "theme-2")) "theme-1 got deactivated by toggling"))) - - (t/deftest activating-missing-theme-noop - (let [tokens-lib (-> (ctob/make-tokens-lib) - (ctob/toggle-theme-active? "group-1" "theme-1"))] - - (t/is (= #{} (ctob/get-active-theme-paths tokens-lib)) "Should not non-existing theme to the active-themes")))) - - (t/testing "serialization" (t/deftest transit-serialization (let [tokens-lib (-> (ctob/make-tokens-lib) @@ -461,15 +413,13 @@ :type :boolean :value true)) (ctob/add-theme (ctob/make-token-theme :name "test-token-theme")) - (ctob/toggle-set-in-theme "" "test-token-theme" "test-token-set") - (ctob/activate-theme "" "test-token-theme")) + (ctob/toggle-set-in-theme "" "test-token-theme" "test-token-set")) encoded-str (tr/encode-str tokens-lib) tokens-lib' (tr/decode-str encoded-str)] (t/is (ctob/valid-tokens-lib? tokens-lib')) (t/is (= (ctob/set-count tokens-lib') 1)) - (t/is (= (ctob/theme-count tokens-lib') 1)) - (t/is (= (ctob/get-active-theme-paths tokens-lib') #{"/test-token-theme"})))) + (t/is (= (ctob/theme-count tokens-lib') 1)))) (t/deftest fressian-serialization (let [tokens-lib (-> (ctob/make-tokens-lib) @@ -478,16 +428,13 @@ :type :boolean :value true)) (ctob/add-theme (ctob/make-token-theme :name "test-token-theme")) - (ctob/toggle-set-in-theme "" "test-token-theme" "test-token-set") - (ctob/activate-theme "" "test-token-theme")) + (ctob/toggle-set-in-theme "" "test-token-theme" "test-token-set")) encoded-blob (fres/encode tokens-lib) tokens-lib' (fres/decode encoded-blob)] (t/is (ctob/valid-tokens-lib? tokens-lib')) (t/is (= (ctob/set-count tokens-lib') 1)) - (t/is (= (ctob/theme-count tokens-lib') 1)) - (t/is (= (ctob/get-active-theme-paths tokens-lib') #{"/test-token-theme"}))))) - + (t/is (= (ctob/theme-count tokens-lib') 1))))) (t/testing "grouping" (t/deftest split-and-join