mirror of
https://github.com/penpot/penpot.git
synced 2026-07-04 05:15:08 +00:00
🐛 Make animation optional in plugin CloseOverlay type and align overlay typings
This commit is contained in:
parent
ab623cc02d
commit
355f7acb66
@ -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))))))
|
||||
|
||||
|
||||
4
plugins/libs/plugin-types/index.d.ts
vendored
4
plugins/libs/plugin-types/index.d.ts
vendored
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user