diff --git a/common/src/app/common/test_helpers/composable/shadow.cljc b/common/src/app/common/test_helpers/composable/shadow.cljc index bb62beab4a..7bad2dca15 100644 --- a/common/src/app/common/test_helpers/composable/shadow.cljc +++ b/common/src/app/common/test_helpers/composable/shadow.cljc @@ -890,10 +890,14 @@ (cond-> result (seq carried) (assoc-in [(:id shape) group] - (merge placed - (when (and root? (= :geometry-group group)) position-orientation) - ;; an attribute the copy leaves unset carries as unset - (into {} (map #(vector % (get old %))) carried))))))) + (cond-> (merge placed + (when (and root? (= :geometry-group group)) position-orientation) + ;; an attribute the copy leaves unset carries as unset + (into {} (map #(vector % (get old %))) carried)) + ;; a carried geometry sits in the new parent, whose later + ;; resizes move and size it through its constraints + (and (= :geometry-group group) new-parent (not root?)) + (vary-meta assoc ::position {:shape shape :parent new-parent :sized? false}))))))) result (cond->> (dissoc groups :swap-group) ;; the head carries only its own layout item overrides (= root-id (:id shape)) diff --git a/common/test/common_tests/logic/composable_gen_test.cljc b/common/test/common_tests/logic/composable_gen_test.cljc index 0eaa626b26..2ea6a87338 100644 --- a/common/test/common_tests/logic/composable_gen_test.cljc +++ b/common/test/common_tests/logic/composable_gen_test.cljc @@ -2423,6 +2423,13 @@ [:combine 5] [:switch 0] [:variant-property 0 0 0 0] [:switch 1] [:combine 0] [:switch 4] [:combine 0] [:switch 0]]})))) +(t/deftest resizing-a-variant-main-resizes-a-switched-copy-child-through-its-constraint + (t/is (map? (cg/run {:world [1 0 {:variants true :text-styles false :library-variants false :stale-libraries false + :layout :grid :layout-item-margins false :grid-square false :library-depth 2 + :library false :rich-variants true :layout-children false :library-text false + :grid-empty false :layout-copies false :text false}] + :ops [[:transform 0 2 0 7] [:delete] [:switch] [:transform 1 1]]})))) + (t/deftest random-shape-structure-compositions (let [coverage (atom {}) failure (atom nil)]