mirror of
https://github.com/penpot/penpot.git
synced 2025-07-30 16:38:27 +02:00
🎉 Add more tests of components
This commit is contained in:
parent
068a099f37
commit
cdab9ff69c
3 changed files with 178 additions and 23 deletions
|
@ -57,7 +57,7 @@
|
|||
(let [page (thp/current-page state)
|
||||
root-inst (cph/get-shape page root-inst-id)
|
||||
|
||||
file (dwlh/get-local-file state)
|
||||
file (dwlh/get-local-file state)
|
||||
component (cph/get-component
|
||||
(:component-id root-inst)
|
||||
(:id file)
|
||||
|
@ -88,3 +88,25 @@
|
|||
|
||||
[shapes-inst shapes-master component]))
|
||||
|
||||
(defn resolve-component
|
||||
[state component-id]
|
||||
(let [page (thp/current-page state)
|
||||
|
||||
file (dwlh/get-local-file state)
|
||||
component (cph/get-component
|
||||
component-id
|
||||
(:id file)
|
||||
file
|
||||
nil)
|
||||
|
||||
root-master (cph/get-component-root
|
||||
component)
|
||||
shapes-master (cph/get-object-with-children
|
||||
(:id root-master)
|
||||
(:objects component))]
|
||||
|
||||
;; Validate that the component tree is well constructed
|
||||
(run! is-noninstance shapes-master)
|
||||
|
||||
[shapes-master component]))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue