template.cljs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. (.visit cy "http://localhost:3001"))
  14. (it "template-basic" []
  15. (.. cy
  16. (get "#search-field")
  17. (click)
  18. (type "template test page")
  19. (wait 1000)
  20. (type "{enter}"))
  21. (util/edit-block "template")
  22. (.. cy
  23. (realPress #js ["Shift" "Enter"]))
  24. (util/edit-block "template:: template-name{enter}")
  25. (util/tab)
  26. (util/edit-block "line1{enter}")
  27. (util/edit-block "line2{enter}")
  28. (util/tab)
  29. (util/edit-block "line3")
  30. (.. cy
  31. (get ".ls-block")
  32. (should (fn [result]
  33. (expect result :to.have.length 4))))
  34. (dorun (repeatedly 3 #(util/edit-block "{enter}")))
  35. (util/edit-block "/template{enter}")
  36. (util/edit-block "template-name{enter}")
  37. (cy.wait 1000)
  38. (.. cy
  39. (get ".ls-block")
  40. (should (fn [result]
  41. (expect result :to.have.length 8))))))