mirror of
https://github.com/penpot/penpot.git
synced 2025-03-31 09:01:20 -05:00
✨ Add test for remove swap slot on detach parent
This commit is contained in:
parent
5b88589157
commit
5872bf024c
1 changed files with 29 additions and 4 deletions
|
@ -743,10 +743,6 @@
|
|||
(t/deftest test-swap-outside-component-doesnt-have-swap-slot
|
||||
(let [;; ==== Setup
|
||||
file (setup-file)
|
||||
|
||||
page (thf/current-page file)
|
||||
blue1 (ths/get-shape file :blue1)
|
||||
|
||||
;; ==== Action
|
||||
|
||||
file' (-> file
|
||||
|
@ -761,3 +757,32 @@
|
|||
;; blue-copy1 has not swap-id
|
||||
(t/is (some? blue-copy1'))
|
||||
(t/is (nil? (ctk/get-swap-slot blue-copy1')))))
|
||||
|
||||
|
||||
(t/deftest test-remove-swap-slot-detach
|
||||
(let [;; ==== Setup
|
||||
file (setup-file)
|
||||
|
||||
page (thf/current-page file)
|
||||
green-copy (ths/get-shape file :green-copy)
|
||||
blue2 (ths/get-shape file :blue2)
|
||||
|
||||
;; ==== Action
|
||||
changes (cll/generate-detach-component (pcb/empty-changes)
|
||||
(:id green-copy)
|
||||
(:data file)
|
||||
(:id page)
|
||||
{(:id file) file})
|
||||
file' (thf/apply-changes file changes)
|
||||
|
||||
;; ==== Get
|
||||
blue2' (ths/get-shape file' :blue2)]
|
||||
|
||||
;; ==== Check
|
||||
|
||||
;; blue2 had swap-id before move
|
||||
(t/is (some? (ctk/get-swap-slot blue2)))
|
||||
|
||||
;; blue2' has not swap-id after move
|
||||
(t/is (some? blue2'))
|
||||
(t/is (nil? (ctk/get-swap-slot blue2')))))
|
||||
|
|
Loading…
Add table
Reference in a new issue