diff --git a/common/src/app/common/logic/libraries.cljc b/common/src/app/common/logic/libraries.cljc index e13f030d5f..5e4ec03656 100644 --- a/common/src/app/common/logic/libraries.cljc +++ b/common/src/app/common/logic/libraries.cljc @@ -274,7 +274,7 @@ (if component (let [shape-main (if reset? ;; the reset is against the ref-shape, not against the original shape of the component - (ctf/find-ref-shape file container libraries shape-inst) + (ctf/find-ref-shape file container libraries shape-inst :include-deleted? true) (ctf/get-content-ref-shape library component shape-inst))] (sync-copy-recursive changes {:container container diff --git a/common/test/common_tests/logic/comp_reset_test.cljc b/common/test/common_tests/logic/comp_reset_test.cljc index 2026aa1894..0e6cce05ff 100644 --- a/common/test/common_tests/logic/comp_reset_test.cljc +++ b/common/test/common_tests/logic/comp_reset_test.cljc @@ -12,6 +12,9 @@ [app.common.logic.shapes :as cls] [app.common.test-helpers.components :as thc] [app.common.test-helpers.composable.comp.nodes :as n] + [app.common.test-helpers.composable.comp.runner :as r] + [app.common.test-helpers.composable.comp.setups :as setup] + [app.common.test-helpers.composable.core :as tm] [app.common.test-helpers.compositions :as tho] [app.common.test-helpers.files :as thf] [app.common.test-helpers.ids-map :as thi] @@ -23,6 +26,20 @@ (t/use-fixtures :each thi/test-fixture) +(t/deftest reset-a-nested-copy-through-a-deleted-outer-main + (let [initial (setup/nested-component-with-copy) + edited (-> initial + (r/step (n/change-property :copy-instance :opacity 0.4)) r/settle) + deleted (-> edited (r/step (n/delete-component :main2-root)) r/settle) + reset (-> deleted (r/step (n/reset :copy-instance)) r/settle) + shape (tm/role-shape reset :copy-instance) + undone (r/step reset (n/undo)) + redone (r/step undone (n/redo))] + (t/is (= (:opacity (tm/role-shape initial :main-instance)) (:opacity shape))) + (t/is (nil? (:touched shape))) + (t/is (= (thn/normalize-file (tm/file deleted)) (thn/normalize-file (tm/file undone)))) + (t/is (= (thn/normalize-file (tm/file reset)) (thn/normalize-file (tm/file redone)))))) + (t/deftest test-reset-after-changing-attribute (let [;; ==== Setup file (-> (thf/sample-file :file1)