add backspace and delete

pull/2257/head
Tienson Qin 2021-06-16 21:26:28 +08:00
parent e617fd29d6
commit 57f20b5f3b
1 changed files with 37 additions and 1 deletions

View File

@ -26,6 +26,19 @@
[]
(.. cy (realPress #js ["Shift" "Tab"])))
(defn backspace
[]
(edit-block "{backspace}"))
(defn delete
[]
(.. cy (realPress "Delete")))
(defn match-content
[value]
(.. cy (get "textarea") (first)
(should "have.value" value)))
(describe "Window"
(beforeEach []
(.clearIndexedDB cy))
@ -61,4 +74,27 @@
(tab)
(edit-block ", continue editing")
(shift+tab)
(edit-block ", continue {enter}")))
(edit-block ", continue {enter}")
;; Backspace to delete a block
(edit-block "test")
;; delete the previous block
(dorun (repeatedly 5 backspace))
(.. cy (get ".ls-block")
(should (fn [result]
(expect result :to.have.length 3))))
(edit-block "{enter}")
;; Del
(edit-block "test")
(edit-block "{leftarrow}{leftarrow}")
(delete)
(delete)
;; FIXME: not working
;; (match-content "te")
(edit-block "{enter}")))