Skip to content

Instantly share code, notes, and snippets.

View martinklepsch's full-sized avatar
👀
Hacking on ctxs.ai

Martin Klepsch martinklepsch

👀
Hacking on ctxs.ai
View GitHub Profile
(def input
[{:t "A" :id 1}
{:t "B" :id 2 :parent 1}
{:t "C" :id 3 :parent 2}
{:t "D" :id 4 :parent 1}
{:t "E" :id 5 :parent 1}
{:t "F" :id 6 :parent 5}
{:t "G" :id 7 :parent 6}
{:t "H" :id 8 :parent 1}])
(deftest signup-flow-test
(t/to "localhost:8001")
(t/click ".header .me")
(t/wait-until (t/exists? "._forgot-password"))
(is (= (t/text "._forgot-password") "Forgot your password?"))
(t/click "#login-form ._signup")
(t/wait-until (t/exists? ".auth-form h3"))
RUN boot -t "build-<SHA>" production build
CMD boot -r "build-<SHA>" start-server
(rum/defc signup < rum/reactive [data]
[:#signup
(if (:error (rum/react data))
[:span.error (:error (rum/react data))])
(input (rum/cursor data [:email]) {:placeholder "Email"})
(input (rum/cursor data [:password]) {:placeholder "Password"})
[:button#signup {:on-click #(async/put! event-bus [:account/new (select-keys @data [:email :password])])}
"Signup"]])
(rum/defc app < rum/reactive [state]
(go-loop []
(.log js/console (pr-str (async/<! ch)))
(recur))
(go-loop [v (async/<! ch)]
(.log js/console (pr-str v))
(recur (async/<! ch))
(rum/defc input < rum/cursored [ref attrs]
[:input (merge {:type "text"
:value @ref
:style {:width 100}
:on-change #(reset! ref (.. % -target -value))}
attrs)])
(rum/defc signup [text]
(let [userdata (atom {:email nil :password nil})]
[:#signup
(set-env!
:source-paths #{"src/cljs" "src/clj"}
:resource-paths #{"resources"}
:dependencies '[[adzerk/boot-cljs "0.0-2629-5" :scope "test"]
[adzerk/boot-cljs-repl "0.1.7" :scope "test"]
[adzerk/boot-reload "0.2.3" :scope "test"]
[pandeiro/boot-http "0.4.2" :scope "test"]
[reagent "0.4.3"]
[cljsjs/react "0.12.2-3"]
[boot-garden "1.2.5-1"]
(ns test-app.app
(:require [om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]))
(defn widget [data owner]
(reify
om/IRender
(render [this]
(dom/h1 nil (:text data)))))
(ns test-app.app
(:require [om.core :as om :include-macros true]
[om.dom :as dom :include-macros true]))
(defn widget [data owner]
(reify
om/IRender
(render [this]
(dom/h1 nil (:text data)))))
(deftest notification-unsuccessful
(testing "Notification check-fn not fulfilled"
(let [requests (atom [])]
(reset! requests [])
(with-fake-http [test-uri (fn [orig-fn opts callback]
(swap! requests conj (:url opts))
{:status 200 :body "ok"})]
(n/notify test-uri #(= % "bla") :wait-times [1 2 3 4])
(Thread/sleep 100) ; Urgs
(is (= 5 (count @requests)))))))