🐛 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:
Andrey Antukh 2026-04-14 12:37:01 +00:00
parent 8b08c8ecc9
commit 2b67e114b6
2 changed files with 3 additions and 7 deletions

View File

@ -262,7 +262,7 @@
(or (nil? current) (= current-id parent-id))
false
(cfh/frame-shape? current-id)
(cfh/frame-shape? current)
(:layout current)
:else

View File

@ -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}]