🎉 Add more tests of components

This commit is contained in:
Andrés Moya 2021-02-03 13:09:38 +01:00 committed by Andrey Antukh
parent 068a099f37
commit cdab9ff69c
3 changed files with 178 additions and 23 deletions

View file

@ -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]))