template.cljs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. (ns app.template
  2. "Template related operations"
  3. (:require-macros [latte.core :refer [describe beforeEach before it]])
  4. (:require [latte.chai :refer (expect)]
  5. [app.util :as util])
  6. (:refer-clojure :exclude [first get]))
  7. (def cy js/cy)
  8. (describe "template"
  9. (beforeEach []
  10. (.clearIndexedDB cy)
  11. (cy.wait 1000))
  12. (before []
  13. (.. cy
  14. (visit "http://localhost:3001")
  15. (get "#main-content-container" #js {:timeout 10000})
  16. (should (fn [result]
  17. (expect result :not.to.contain "Loading")))))
  18. (it "template-basic" []
  19. (.. cy
  20. (get "#search-button")
  21. (click)
  22. (get "input.cp__palette-input")
  23. (type "template test page")
  24. (wait 1000)
  25. (type "{enter}"))
  26. (util/edit-block "template")
  27. (.. cy
  28. (realPress #js ["Shift" "Enter"]))
  29. (util/edit-block "template:: template-name{enter}{enter}")
  30. (util/tab)
  31. (util/edit-block "line1{enter}")
  32. (util/edit-block "line2{enter}")
  33. (util/tab)
  34. (util/edit-block "line3")
  35. (.. cy
  36. (get ".ls-block")
  37. (should (fn [result]
  38. (expect result :to.have.length 4))))
  39. (dorun (repeatedly 3 #(util/edit-block "{enter}")))
  40. (util/edit-block "/template{enter}")
  41. (util/edit-block "template-name{enter}")
  42. (cy.wait 1000)
  43. (.. cy
  44. (get ".ls-block")
  45. (should (fn [result]
  46. (expect result :to.have.length 8))))))