mirror of
https://github.com/penpot/penpot.git
synced 2025-08-07 14:38:33 +02: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
|
(t/deftest test-swap-outside-component-doesnt-have-swap-slot
|
||||||
(let [;; ==== Setup
|
(let [;; ==== Setup
|
||||||
file (setup-file)
|
file (setup-file)
|
||||||
|
|
||||||
page (thf/current-page file)
|
|
||||||
blue1 (ths/get-shape file :blue1)
|
|
||||||
|
|
||||||
;; ==== Action
|
;; ==== Action
|
||||||
|
|
||||||
file' (-> file
|
file' (-> file
|
||||||
|
@ -761,3 +757,32 @@
|
||||||
;; blue-copy1 has not swap-id
|
;; blue-copy1 has not swap-id
|
||||||
(t/is (some? blue-copy1'))
|
(t/is (some? blue-copy1'))
|
||||||
(t/is (nil? (ctk/get-swap-slot 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
Add a link
Reference in a new issue