mirror of
https://github.com/penpot/penpot.git
synced 2026-04-25 11:18:36 +00:00
🐛 Fix inside-layout? passing id instead of shape to frame-shape?
`(cfh/frame-shape? current-id)` passes a UUID to the single-arity overload of `frame-shape?`, which expects a shape map; it always returns false. Fix by passing `current` (the resolved shape) instead. Update the test to assert the correct behaviour. Signed-off-by: Andrey Antukh <niwi@niwi.nz>
This commit is contained in:
parent
8b08c8ecc9
commit
2b67e114b6
@ -262,7 +262,7 @@
|
||||
(or (nil? current) (= current-id parent-id))
|
||||
false
|
||||
|
||||
(cfh/frame-shape? current-id)
|
||||
(cfh/frame-shape? current)
|
||||
(:layout current)
|
||||
|
||||
:else
|
||||
|
||||
@ -186,13 +186,9 @@
|
||||
flex (make-flex-frame :parent-id root-id)
|
||||
child (make-shape :parent-id (:id flex))]
|
||||
|
||||
;; Note: inside-layout? calls (cfh/frame-shape? current-id) with a UUID id,
|
||||
;; but frame-shape? checks (:type uuid) which is nil for a UUID value.
|
||||
;; The function therefore always returns false regardless of structure.
|
||||
;; These tests document the actual (not the intended) behavior.
|
||||
(t/testing "returns false when child is under a flex frame"
|
||||
(t/testing "returns true when child is under a flex frame"
|
||||
(let [objects {root-id root (:id flex) flex (:id child) child}]
|
||||
(t/is (not (layout/inside-layout? objects child)))))
|
||||
(t/is (layout/inside-layout? objects child))))
|
||||
|
||||
(t/testing "returns false for root shape"
|
||||
(let [objects {root-id root (:id flex) flex (:id child) child}]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user