From 355f7acb668a27733ed35f71fad0d4527c0077e6 Mon Sep 17 00:00:00 2001 From: mvanhorn Date: Wed, 17 Jun 2026 10:29:53 -0700 Subject: [PATCH] :bug: Make animation optional in plugin CloseOverlay type and align overlay typings --- .../frontend_tests/plugins/parser_test.cljs | 35 +++++++++++++++++++ plugins/libs/plugin-types/index.d.ts | 4 +-- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/frontend/test/frontend_tests/plugins/parser_test.cljs b/frontend/test/frontend_tests/plugins/parser_test.cljs index 99b248e205..e6f78c185f 100644 --- a/frontend/test/frontend_tests/plugins/parser_test.cljs +++ b/frontend/test/frontend_tests/plugins/parser_test.cljs @@ -138,3 +138,38 @@ (t/is (= :manual (:overlay-pos-type result))) (t/is (not (contains? result :overlay-position))) (t/is (valid-interaction? result))))) + +(t/deftest test-parse-close-overlay-without-animation-validates + (t/testing "close-overlay without animation parses and validates" + (let [result (parser/parse-interaction "click" #js {:type "close-overlay"} nil)] + (t/is (= {:event-type :click + :action-type :close-overlay} + result)) + (t/is (false? (contains? result :animation))) + (t/is (true? (sm/validate ctsi/schema:interaction result))))) + + (t/testing "close-overlay preserves destination without animation" + (let [destination-id (uuid/next) + result (parser/parse-interaction + "click" + #js {:type "close-overlay" + :destination #js {"$id" destination-id}} + nil)] + (t/is (= destination-id (:destination result))) + (t/is (false? (contains? result :animation))) + (t/is (true? (sm/validate ctsi/schema:interaction result))))) + + (t/testing "close-overlay preserves an explicit dissolve animation" + (let [result (parser/parse-interaction + "click" + #js {:type "close-overlay" + :animation #js {:type "dissolve" + :duration 300 + :easing "linear"}} + nil)] + (t/is (= {:animation-type :dissolve + :duration 300 + :easing :linear} + (:animation result))) + (t/is (true? (sm/validate ctsi/schema:interaction result)))))) + diff --git a/plugins/libs/plugin-types/index.d.ts b/plugins/libs/plugin-types/index.d.ts index 2548a05ebb..b232a16e78 100644 --- a/plugins/libs/plugin-types/index.d.ts +++ b/plugins/libs/plugin-types/index.d.ts @@ -485,9 +485,9 @@ export interface CloseOverlay { readonly destination?: Board; /** - * Animation displayed with this interaction. + * Animation displayed with this interaction. Omit it to close with no transition. */ - readonly animation: Animation; + readonly animation?: Animation; } /**