mirror of
https://github.com/penpot/penpot.git
synced 2026-10-30 14:30:37 +00:00
🐛 Resolve deleted near mains when resetting nested copies
Include cached deleted mains when resolving the position of a nested copy. Reset previously passed nil to container lookup and threw. Validation: reset and move suites, 21 tests / 92 assertions. The new reset regression failed before the fix and checks undo and redo. Benchmark ratios against Phase 1e: main 10/100/1000 copies 0.54/0.56/0.60; three levels 0.52; chain 0.52; library 0.55; many shapes 0.58; variant switch 0.61. No regression flag. AI-assisted-by: GPT-6
This commit is contained in:
parent
35b0a893e6
commit
e2b47a91fe
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user