diff --git a/common/src/app/common/test_helpers/composable/comp/nodes.cljc b/common/src/app/common/test_helpers/composable/comp/nodes.cljc index db2414a814..2fd6686531 100644 --- a/common/src/app/common/test_helpers/composable/comp/nodes.cljc +++ b/common/src/app/common/test_helpers/composable/comp/nodes.cljc @@ -1058,12 +1058,13 @@ root-id (tm/target-shape-id situation target) page (thf/current-page the-file) component-id (:component-id (get (:objects page) root-id)) - [_ changes] (cls/generate-delete-shapes (pcb/empty-changes nil (:id page)) - (:data the-file) - page - (:objects page) - #{root-id} - {}) + [all-parents changes] (cls/generate-delete-shapes (pcb/empty-changes nil (:id page)) + (:data the-file) + page + (:objects page) + #{root-id} + {}) + changes (with-layouts-reflow changes all-parents) file' (thf/apply-changes the-file changes :validate? false)] (-> situation (tm/with-file file') @@ -1114,6 +1115,8 @@ (:id the-file) page (:objects page)) + ;; the frontend lays out the frames the restored shapes go into + changes (with-layouts-reflow changes (keep :frame-id (:redo-changes changes))) file' (thf/apply-changes the-file changes :validate? false)] (-> situation (tm/with-file file') diff --git a/common/test/common_tests/logic/composable_gen_test.cljc b/common/test/common_tests/logic/composable_gen_test.cljc index 858751b5c4..28faf9e86f 100644 --- a/common/test/common_tests/logic/composable_gen_test.cljc +++ b/common/test/common_tests/logic/composable_gen_test.cljc @@ -1749,6 +1749,14 @@ :grid-empty false :layout-copies true :text true}] :ops [[:swap 0 0 0 0] [:library-add-variant 0 0 0 0] [:library-sync] [:switch 0]]})))) +(t/deftest moving-a-shape-in-a-restored-library-variant-moves-it-by-the-requested-offset + (t/is (map? (cg/run {:world [2 0 {:variants true :text-styles true :library-variants true :stale-libraries true + :layout nil :layout-item-margins false :grid-square false :library-depth 1 + :library true :rich-variants true :layout-children false :library-text true + :grid-empty false :layout-copies true :text true}] + :ops [[:library-make-variant 0] [:library-sync] [:switch 0] [:library-delete 1] + [:library-sync] [:library-restore 1] [:library-sync] [:library-transform 0 0 4 1]]})))) + (t/deftest switching-a-copy-keeps-the-layout-item-overrides-of-its-children (t/is (map? (cg/run {:world [3 2 {:variants true :text-styles true :layout :grid :variant-diff false :layout-item-margins false :grid-square false :rich-variants true