♻️ Cleanup of componentsv2

This commit is contained in:
Pablo Alba 2025-04-01 16:45:40 +02:00
parent 1e16fb8ca2
commit f961b75bba
39 changed files with 282 additions and 1207 deletions

View file

@ -40,8 +40,6 @@
(:objects page)
(:id page)
(:id file)
true
nil
nil)
file' (thf/apply-changes file changes)
@ -74,8 +72,6 @@
(:objects page)
(:id page)
(:id file)
true
nil
cfsh/prepare-create-artboard-from-selection)
file' (thf/apply-changes file changes)
@ -111,8 +107,6 @@
(:objects page)
(:id page)
(:id file)
true
nil
cfsh/prepare-create-artboard-from-selection)
file' (thf/apply-changes file changes)
@ -151,8 +145,6 @@
(:objects page)
(:id page)
(:id file)
true
nil
cfsh/prepare-create-artboard-from-selection)
file' (thf/apply-changes file changes)
@ -191,8 +183,6 @@
(:objects page)
(:id page)
(:id file)
true
nil
nil)
file' (thf/apply-changes file changes)
@ -232,8 +222,6 @@
(:objects page)
(:id page)
(:id file)
true
nil
cfsh/prepare-create-artboard-from-selection)
file' (thf/apply-changes file changes)
@ -265,8 +253,7 @@
changes (cll/generate-rename-component (pcb/empty-changes)
(:id component)
"Test component after"
(:data file)
true)
(:data file))
file' (thf/apply-changes file changes)
@ -445,8 +432,8 @@
(t/is (some? copy1-child'))
(t/is (ctk/instance-root? copy1-root'))
(t/is (ctk/instance-of? copy1-root' (:id file') (:id component')))
(t/is (ctk/is-main-of? main1-root' copy1-root' true))
(t/is (ctk/is-main-of? main1-child' copy1-child' true))
(t/is (ctk/is-main-of? main1-root' copy1-root'))
(t/is (ctk/is-main-of? main1-child' copy1-child'))
(t/is (ctst/parent-of? copy1-root' copy1-child'))))
(t/deftest test-instantiate-component-from-lib
@ -489,8 +476,8 @@
(t/is (some? copy1-child'))
(t/is (ctk/instance-root? copy1-root'))
(t/is (ctk/instance-of? copy1-root' (:id library) (:id component')))
(t/is (ctk/is-main-of? main1-root' copy1-root' true))
(t/is (ctk/is-main-of? main1-child' copy1-child' true))
(t/is (ctk/is-main-of? main1-root' copy1-root'))
(t/is (ctk/is-main-of? main1-child' copy1-child'))
(t/is (ctst/parent-of? copy1-root' copy1-child'))))
(t/deftest test-instantiate-nested-component
@ -533,8 +520,8 @@
(t/is (some? copy1-child'))
(t/is (ctk/instance-root? copy1-root'))
(t/is (ctk/instance-of? copy1-root' (:id file') (:id component')))
(t/is (ctk/is-main-of? main1-root' copy1-root' true))
(t/is (ctk/is-main-of? main1-child' copy1-child' true))
(t/is (ctk/is-main-of? main1-root' copy1-root'))
(t/is (ctk/is-main-of? main1-child' copy1-child'))
(t/is (ctst/parent-of? copy1-root' copy1-child'))))
(t/deftest test-instantiate-nested-component-from-lib
@ -580,8 +567,8 @@
(t/is (some? copy1-child'))
(t/is (ctk/instance-root? copy1-root'))
(t/is (ctk/instance-of? copy1-root' (:id library) (:id component')))
(t/is (ctk/is-main-of? main1-root' copy1-root' true))
(t/is (ctk/is-main-of? main1-child' copy1-child' true))
(t/is (ctk/is-main-of? main1-root' copy1-root'))
(t/is (ctk/is-main-of? main1-child' copy1-child'))
(t/is (ctst/parent-of? copy1-root' copy1-child'))))
(t/deftest test-detach-copy

View file

@ -47,8 +47,7 @@
file-mdf
{(:id file-mdf) file-mdf}
page-mdf
(:id copy-root)
true)
(:id copy-root))
file' (thf/apply-changes file changes)
@ -99,8 +98,7 @@
{(:id file-mdf) file-mdf
(:id library) library}
page-mdf
(:id copy-root)
true)
(:id copy-root))
file' (thf/apply-changes file changes)
@ -151,8 +149,7 @@
file-mdf
{(:id file-mdf) file-mdf}
page-mdf
(:id copy-root)
true)
(:id copy-root))
file' (thf/apply-changes file changes)
@ -198,8 +195,7 @@
file-mdf
{(:id file-mdf) file-mdf}
page-mdf
(:id copy-root)
true)
(:id copy-root))
file' (thf/apply-changes file changes)
@ -246,8 +242,7 @@
file-mdf
{(:id file-mdf) file-mdf}
page-mdf
(:id copy-root)
true)
(:id copy-root))
file' (thf/apply-changes file changes)
@ -291,8 +286,7 @@
file-mdf
{(:id file-mdf) file-mdf}
page-mdf
(:id copy2-root)
true)
(:id copy2-root))
file' (thf/apply-changes file changes)
@ -338,8 +332,7 @@
file-mdf
{(:id file-mdf) file-mdf}
page-mdf
(:id copy2-root)
true)
(:id copy2-root))
file' (thf/apply-changes file changes)

View file

@ -227,7 +227,7 @@
(t/is (= (:touched copy-root') nil))
(t/is (= (:touched copy-new-child') nil))
(t/is (ctst/parent-of? copy-root' copy-new-child'))
(t/is (ctk/is-main-of? main-free-shape' copy-new-child' true))))
(t/is (ctk/is-main-of? main-free-shape' copy-new-child'))))
(t/deftest test-sync-when-deleting-shape
(let [;; ==== Setup

View file

@ -54,7 +54,7 @@
(t/is (= (count components') 1))
(t/is (ctk/instance-of? copy-root' (:id file') (:id component')))
(t/is (ctk/is-main-of? main-root' copy-root' true))
(t/is (ctk/is-main-of? main-root' copy-root'))
(t/is (ctk/main-instance-of? (:id main-root') (:id (second pages')) component'))))
(t/deftest absorb-colors