Last active
December 10, 2015 21:48
-
-
Save ConnerPetzold/4497718 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns webapp.client.test.newsfeed-test | |
(:require [webapp.client.utils :as utils])) | |
(defn wait-for-event [event timeout callback] | |
(let [timeout-id (.setTimeout js/window #(callback false) timeout)] | |
(.on (js/$ js/window) event | |
(fn [_ res] | |
(callback res) | |
(.clearTimeout js/window timeout-id))))) | |
(defn test-interest-add [done] | |
(let [action-el (.first (js/$ ".article .action:not(.checked)"))] | |
(assert (.is action-el "span")) | |
(assert (not (.hasClass action-el "checked"))) | |
(wait-for-event "POST:/user/interests/update" 3000 | |
(fn [response] | |
(utils/log response) | |
(assert response) | |
(assert (.hasClass action-el "checked")) | |
(done))) | |
(.click action-el))) | |
(defn test-interest-remove [done] | |
(let [first-interest-action (.first (js/$ ".action"))] | |
(utils/log first-interest-action) | |
(done))) | |
(defn ^export run [tests] | |
(when-let [[first-test & more-tests] (seq tests)] | |
(first-test #(run more-tests)))) | |
(defn init [] | |
(when js/prismatic.test | |
(run | |
[test-interest-add]))) | |
(.load (js/$ js/window) init) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment