mirror of
https://github.com/penpot/penpot.git
synced 2025-05-10 10:36:38 +02:00
✨ Improved transformation from and to JS for plugins
This commit is contained in:
parent
42230f2630
commit
ac58a5b8fa
15 changed files with 1359 additions and 622 deletions
|
@ -162,9 +162,8 @@
|
|||
:offset-y 4
|
||||
:blur 4
|
||||
:spread 0
|
||||
:color {:color "#FABADA" :opacity 1}
|
||||
:color {:color "#fabada" :opacity 1}
|
||||
:hidden false}]))))
|
||||
|
||||
(let [shadow #js {:style "fail"}]
|
||||
(set! (.-shadows shape) #js [shadow])
|
||||
(t/is (= (-> (. shape -shadows) (aget 0) (aget "style")) "drop-shadow"))))
|
||||
|
@ -208,20 +207,20 @@
|
|||
|
||||
(t/testing " - fills"
|
||||
(set! (.-fills shape) #js [#js {:fillColor 100}])
|
||||
(t/is (= (-> (. shape -fills) (aget 0) (aget "fillColor")) "#B1B2B5"))
|
||||
(t/is (= (get-in @store (get-shape-path :fills)) [{:fill-color "#B1B2B5" :fill-opacity 1}]))
|
||||
(t/is (= (-> (. shape -fills) (aget 0) (aget "fillColor")) "#B1B2B5"))
|
||||
|
||||
(set! (.-fills shape) #js [#js {:fillColor "#FABADA" :fillOpacity 1}])
|
||||
(t/is (= (-> (. shape -fills) (aget 0) (aget "fillColor")) "#FABADA"))
|
||||
(t/is (= (-> (. shape -fills) (aget 0) (aget "fillOpacity")) 1))
|
||||
(t/is (= (get-in @store (get-shape-path :fills)) [{:fill-color "#FABADA" :fill-opacity 1}])))
|
||||
(set! (.-fills shape) #js [#js {:fillColor "#fabada" :fillOpacity 1}])
|
||||
(t/is (= (get-in @store (get-shape-path :fills)) [{:fill-color "#fabada" :fill-opacity 1}]))
|
||||
(t/is (= (-> (. shape -fills) (aget 0) (aget "fillColor")) "#fabada"))
|
||||
(t/is (= (-> (. shape -fills) (aget 0) (aget "fillOpacity")) 1)))
|
||||
|
||||
(t/testing " - strokes"
|
||||
(set! (.-fills shape) #js [#js {:strokeColor "#FABADA" :strokeOpacity 1 :stroke-width 5}])
|
||||
(t/is (= (-> (. shape -fills) (aget 0) (aget "strokeColor")) "#FABADA"))
|
||||
(t/is (= (-> (. shape -fills) (aget 0) (aget "strokeOpacity")) 1))
|
||||
(t/is (= (-> (. shape -fills) (aget 0) (aget "strokeWidth")) 5))
|
||||
(t/is (= (get-in @store (get-shape-path :fills)) [{:stroke-color "#FABADA" :stroke-opacity 1 :stroke-width 5}]))))
|
||||
(set! (.-strokes shape) #js [#js {:strokeColor "#fabada" :strokeOpacity 1 :strokeWidth 5}])
|
||||
(t/is (= (get-in @store (get-shape-path :strokes)) [{:stroke-color "#fabada" :stroke-opacity 1 :stroke-width 5}]))
|
||||
(t/is (= (-> (. shape -strokes) (aget 0) (aget "strokeColor")) "#fabada"))
|
||||
(t/is (= (-> (. shape -strokes) (aget 0) (aget "strokeOpacity")) 1))
|
||||
(t/is (= (-> (. shape -strokes) (aget 0) (aget "strokeWidth")) 5))))
|
||||
|
||||
(t/testing "Relative properties"
|
||||
(let [frame (.createFrame context)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue