mirror of
https://github.com/penpot/penpot.git
synced 2025-08-03 11:48:32 +02:00
🐛 Properly handle group naming on group creation.
This commit is contained in:
parent
08062e8ce8
commit
38292bcda7
4 changed files with 30 additions and 32 deletions
|
@ -89,11 +89,11 @@
|
|||
|
||||
;; NOTE: the group name depends on having executed
|
||||
;; the previous test.
|
||||
(t/is (= (:name group) "Component-2"))
|
||||
(t/is (= (:name group) "Component-1"))
|
||||
(t/is (= (:name shape1) "Rect 1"))
|
||||
(t/is (= (:name shape2) "Rect 2"))
|
||||
(t/is (= (:name component) "Component-2"))
|
||||
(t/is (= (:name c-group) "Component-2"))
|
||||
(t/is (= (:name component) "Component-1"))
|
||||
(t/is (= (:name c-group) "Component-1"))
|
||||
(t/is (= (:name c-shape1) "Rect 1"))
|
||||
(t/is (= (:name c-shape2) "Rect 2"))
|
||||
|
||||
|
@ -139,11 +139,11 @@
|
|||
|
||||
(t/is (= (:name shape1) "Rect 1"))
|
||||
(t/is (= (:name shape2) "Rect 2"))
|
||||
(t/is (= (:name group) "Group-3"))
|
||||
(t/is (= (:name component) "Group-3"))
|
||||
(t/is (= (:name group) "Group-1"))
|
||||
(t/is (= (:name component) "Group-1"))
|
||||
(t/is (= (:name c-shape1) "Rect 1"))
|
||||
(t/is (= (:name c-shape2) "Rect 2"))
|
||||
(t/is (= (:name c-group) "Group-3"))
|
||||
(t/is (= (:name c-group) "Group-1"))
|
||||
|
||||
(thl/is-from-file group file))))
|
||||
|
||||
|
@ -234,7 +234,7 @@
|
|||
new-component-id)]
|
||||
|
||||
(t/is (= (:name component2)
|
||||
"Component-6")))))
|
||||
"Component-2")))))
|
||||
|
||||
(rx/subs
|
||||
done
|
||||
|
@ -322,9 +322,9 @@
|
|||
|
||||
(t/is (not= (:id instance1) (:id instance2)))
|
||||
(t/is (= (:id component) component-id))
|
||||
(t/is (= (:name instance2) "Component-8"))
|
||||
(t/is (= (:name instance2) "Component-2"))
|
||||
(t/is (= (:name shape2) "Rect 1"))
|
||||
(t/is (= (:name c-instance2) "Component-7"))
|
||||
(t/is (= (:name c-instance2) "Component-1"))
|
||||
(t/is (= (:name c-shape2) "Rect 1")))))
|
||||
|
||||
(rx/subs
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
[app.common.pages :as cp]
|
||||
[app.common.pages.helpers :as cph]
|
||||
[app.main.data.workspace :as dw]
|
||||
[app.main.data.workspace.state-helpers :as wsh]
|
||||
[app.main.data.workspace.groups :as dwg]
|
||||
[app.main.data.workspace.libraries-helpers :as dwlh]))
|
||||
|
||||
|
@ -79,7 +80,7 @@
|
|||
:obj shape}]))))
|
||||
|
||||
(defn group-shapes
|
||||
([state label ids] (group-shapes state label ids "Group-"))
|
||||
([state label ids] (group-shapes state label ids "Group"))
|
||||
([state label ids prefix]
|
||||
(let [page (current-page state)
|
||||
shapes (dwg/shapes-for-grouping (:objects page) ids)]
|
||||
|
@ -94,9 +95,9 @@
|
|||
|
||||
(defn make-component
|
||||
[state label ids]
|
||||
(let [page (current-page state)
|
||||
objects (wsh/lookup-page-objects state page-id)
|
||||
shapes (dwg/shapes-for-grouping objects ids)
|
||||
(let [page (current-page state)
|
||||
objects (wsh/lookup-page-objects state (:id page))
|
||||
shapes (dwg/shapes-for-grouping objects ids)
|
||||
|
||||
[group rchanges uchanges]
|
||||
(dwlh/generate-add-component shapes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue