mirror of
https://github.com/penpot/penpot.git
synced 2025-12-11 22:14:05 +01:00
🎉 Update tests
This commit is contained in:
@@ -7,20 +7,14 @@
|
||||
(ns frontend-tests.helpers.pages
|
||||
(:require
|
||||
[app.common.geom.point :as gpt]
|
||||
[app.common.geom.shapes :as gsh]
|
||||
[app.common.pages :as cp]
|
||||
[app.common.pages.helpers :as cph]
|
||||
[app.common.types.shape :as cts]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.main.data.workspace :as dw]
|
||||
[app.main.data.workspace.groups :as dwg]
|
||||
[app.main.data.workspace.layout :as layout]
|
||||
[app.main.data.workspace.libraries-helpers :as dwlh]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[beicon.core :as rx]
|
||||
[cljs.pprint :refer [pprint]]
|
||||
[cljs.test :as t :include-macros true]
|
||||
[potok.core :as ptk]))
|
||||
[app.main.data.workspace.state-helpers :as wsh]))
|
||||
|
||||
;; ---- Helpers to manage pages and objects
|
||||
|
||||
@@ -32,10 +26,12 @@
|
||||
:workspace-layout layout/default-layout
|
||||
:workspace-global layout/default-global
|
||||
:workspace-data {:id current-file-id
|
||||
:options {:components-v2 true}
|
||||
:components {}
|
||||
:pages []
|
||||
:pages-index {}}
|
||||
:workspace-libraries {}})
|
||||
:workspace-libraries {}
|
||||
:features {:components-v2 true}})
|
||||
|
||||
(def ^:private idmap (atom {}))
|
||||
|
||||
@@ -56,6 +52,11 @@
|
||||
(let [page (current-page state)]
|
||||
(get-in page [:objects (id label)])))
|
||||
|
||||
(defn get-children
|
||||
[state label]
|
||||
(let [page (current-page state)]
|
||||
(cph/get-children (:objects page) (id label))))
|
||||
|
||||
(defn sample-page
|
||||
([state] (sample-page state {}))
|
||||
([state {:keys [id name] :as props
|
||||
@@ -106,7 +107,7 @@
|
||||
objects (wsh/lookup-page-objects state (:id page))
|
||||
shapes (dwg/shapes-for-grouping objects shape-ids)
|
||||
|
||||
[group component-root changes]
|
||||
[group component-id changes]
|
||||
(dwlh/generate-add-component nil
|
||||
shapes
|
||||
(:objects page)
|
||||
@@ -115,7 +116,7 @@
|
||||
true)]
|
||||
|
||||
(swap! idmap assoc instance-label (:id group)
|
||||
component-label (:id component-root))
|
||||
component-label component-id)
|
||||
(update state :workspace-data
|
||||
cp/process-changes (:redo-changes changes))))
|
||||
|
||||
@@ -148,7 +149,9 @@
|
||||
assoc library-id {:id library-id
|
||||
:name name
|
||||
:data {:id library-id
|
||||
:options (:options data)
|
||||
:pages (:pages data)
|
||||
:pages-index (:pages-index data)
|
||||
:components (:components data)}})
|
||||
(update :workspace-data
|
||||
assoc :components {} :pages [] :pages-index {}))))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user