diff --git a/common/src/app/common/types/shape/layout.cljc b/common/src/app/common/types/shape/layout.cljc index e6e776d8a8..215d9709cf 100644 --- a/common/src/app/common/types/shape/layout.cljc +++ b/common/src/app/common/types/shape/layout.cljc @@ -1271,7 +1271,9 @@ ;; TODO: Remove after testing (assert (empty? (overlapping-cells parent)) (dm/str (overlapping-cells parent))) - (assoc parent :layout-grid-cells cells))))) + (-> parent + (assoc :layout-grid-cells cells) + (assign-cell-positions objects)))))) (defn free-cell-push "Frees the cell at index and push the shapes in the order given by the `cells` attribute" diff --git a/common/test/common_tests/types/shape_layout_test.cljc b/common/test/common_tests/types/shape_layout_test.cljc index 3aa0b08b95..d32ea5a6b6 100644 --- a/common/test/common_tests/types/shape_layout_test.cljc +++ b/common/test/common_tests/types/shape_layout_test.cljc @@ -1308,6 +1308,20 @@ ;; check-deassigned-cells ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(t/deftest assigning-overflow-cells-is-idempotent-after-a-manual-cell + (let [children [(make-shape) (make-shape)] + objects (into {} (map (juxt :id identity)) children) + parent (-> (make-grid-frame :shapes (mapv :id children)) + (layout/add-grid-row {:type :flex :value 1}) + (layout/add-grid-column {:type :flex :value 1})) + cell-id (first (keys (:layout-grid-cells parent))) + parent (-> parent + (assoc-in [:layout-grid-cells cell-id :shapes] [(:id (first children))]) + (assoc-in [:layout-grid-cells cell-id :position] :manual)) + assigned (layout/assign-cells parent objects)] + (t/is (= assigned (layout/assign-cells assigned objects))) + (t/is (= #{:manual} (into #{} (map :position) (vals (:layout-grid-cells assigned))))))) + (t/deftest check-deassigned-cells-test (t/testing "removes shape ids no longer in parent's shapes list" (let [old-id (uuid/next)