mirror of
https://github.com/penpot/penpot.git
synced 2025-03-09 22:31:50 -05:00
🐛 Fix keep name of component equal to the shape name
This commit is contained in:
parent
e5430259e9
commit
badb5c6a9b
3 changed files with 12 additions and 11 deletions
|
@ -46,6 +46,7 @@
|
|||
- Fix "open in new tab" on dashboard [Taiga #2235](https://tree.taiga.io/project/penpot/issue/2355)
|
||||
- Changing pages while comments activated will not close the panel [#1350](https://github.com/penpot/penpot/issues/1350)
|
||||
- Fix navigate comments in right sidebar [Taiga #2163](https://tree.taiga.io/project/penpot/issue/2163)
|
||||
- Fix keep name of component equal to the shape name [Taiga #2341](https://tree.taiga.io/project/penpot/issue/2341)
|
||||
|
||||
### :arrow_up: Deps updates
|
||||
|
||||
|
|
|
@ -130,11 +130,12 @@
|
|||
(if (and (= (count shapes) 1)
|
||||
(:component-id (first shapes)))
|
||||
empty-changes
|
||||
(let [[group rchanges uchanges]
|
||||
(let [name (if (= 1 (count shapes)) (:name (first shapes)) "Component-1")
|
||||
[group rchanges uchanges]
|
||||
(if (and (= (count shapes) 1)
|
||||
(= (:type (first shapes)) :group))
|
||||
[(first shapes) [] []]
|
||||
(dwg/prepare-create-group objects page-id shapes "Component-1" true))
|
||||
(dwg/prepare-create-group objects page-id shapes name true))
|
||||
|
||||
;; Asserts for documentation purposes
|
||||
_ (us/assert vector? rchanges)
|
||||
|
@ -146,7 +147,7 @@
|
|||
rchanges (conj rchanges
|
||||
{:type :add-component
|
||||
:id (:id new-shape)
|
||||
:name (:name new-shape)
|
||||
:name name
|
||||
:shapes new-shapes})
|
||||
|
||||
rchanges (into rchanges
|
||||
|
|
|
@ -215,7 +215,7 @@
|
|||
(let [state (-> thp/initial-state
|
||||
(thp/sample-page)
|
||||
(thp/sample-shape :shape1 :rect
|
||||
{:name "Rect 1"})
|
||||
{:name "Rect-1"})
|
||||
(thp/make-component :instance1
|
||||
[(thp/id :shape1)]))
|
||||
|
||||
|
@ -247,8 +247,7 @@
|
|||
new-state
|
||||
new-component-id)]
|
||||
|
||||
(t/is (= (:name component2)
|
||||
"Component-2")))))
|
||||
(t/is (= (:name component2) "Rect-2")))))
|
||||
|
||||
(rx/subs done #(throw %))))))
|
||||
|
||||
|
@ -292,7 +291,7 @@
|
|||
(let [state (-> thp/initial-state
|
||||
(thp/sample-page)
|
||||
(thp/sample-shape :shape1 :rect
|
||||
{:name "Rect 1"})
|
||||
{:name "Rect-1"})
|
||||
(thp/make-component :instance1
|
||||
[(thp/id :shape1)]))
|
||||
|
||||
|
@ -320,10 +319,10 @@
|
|||
|
||||
(t/is (not= (:id instance1) (:id instance2)))
|
||||
(t/is (= (:id component) component-id))
|
||||
(t/is (= (:name instance2) "Component-2"))
|
||||
(t/is (= (:name shape2) "Rect 1"))
|
||||
(t/is (= (:name c-instance2) "Component-1"))
|
||||
(t/is (= (:name c-shape2) "Rect 1")))))
|
||||
(t/is (= (:name instance2) "Rect-3"))
|
||||
(t/is (= (:name shape2) "Rect-1"))
|
||||
(t/is (= (:name c-instance2) "Rect-2"))
|
||||
(t/is (= (:name c-shape2) "Rect-1")))))
|
||||
|
||||
(rx/subs done #(throw %))))))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue