mirror of
https://github.com/logseq/logseq.git
synced 2026-06-01 19:01:22 +00:00
Add a test for copied blocks
Also removed a prn
This commit is contained in:
@@ -121,6 +121,24 @@
|
||||
(is (= expected-paste result))
|
||||
(reset))))))
|
||||
|
||||
(deftest-async editor-on-paste-with-copied-blocks
|
||||
(let [actual-blocks (atom nil)
|
||||
;; Simplified version of block attributes that are copied
|
||||
expected-blocks [{:block/content "Test node"}
|
||||
{:block/content "Notes\nid:: 6422ec75-85c7-4e09-9a4d-2a1639a69b2f"}]
|
||||
clipboard "- Test node\n\t- Notes\nid:: 6422ec75-85c7-4e09-9a4d-2a1639a69b2f"]
|
||||
(test-helper/with-reset
|
||||
reset
|
||||
[state/get-input (constantly #js {:value "block"})
|
||||
;; paste-copied-blocks-or-text mocks below
|
||||
util/stop (constantly nil)
|
||||
paste-handler/get-copied-blocks (constantly (p/resolved expected-blocks))
|
||||
editor-handler/paste-blocks (fn [blocks _] (reset! actual-blocks blocks))]
|
||||
(p/let [_ ((paste-handler/editor-on-paste! nil)
|
||||
#js {:clipboardData #js {:getData (constantly clipboard)}})]
|
||||
(is (= expected-blocks @actual-blocks))
|
||||
(reset)))))
|
||||
|
||||
(deftest-async editor-on-paste-with-selection-in-property
|
||||
(let [clipboard "after"
|
||||
expected-paste "after"
|
||||
|
||||
Reference in New Issue
Block a user