Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
78 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
.lein* | ||
lib | ||
public/*.js | ||
out/ | ||
target/ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
(defproject com.keminglabs/reflex "0.1.0-SNAPSHOT" | ||
:description "ClojureScript state propagation." | ||
:license {:name "BSD" :url "http://www.opensource.org/licenses/BSD-3-Clause"} | ||
|
||
:dependencies [[org.clojure/clojure "1.4.0"]] | ||
|
||
:min-lein-version "2.0.0" | ||
|
||
:plugins [[lein-cljsbuild "0.1.10"]] | ||
:plugins [[lein-cljsbuild "0.2.1"]] | ||
|
||
:source-paths ["src/clj" "src/cljs"] | ||
|
||
:cljsbuild {:builds {:test {:source-path "test/cljs" | ||
:cljsbuild {:builds {:test {:source-path "test/integration" | ||
:compiler {:output-to "out/test/integration.js" | ||
:optimizations :simple | ||
:pretty-print true}}}}) | ||
:optimizations :whitespace | ||
:pretty-print true}}} | ||
|
||
:test-commands {"integration" ["phantomjs" | ||
"test/integration/runner.coffee"]} | ||
}) |
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
(ns test.integration.integration | ||
(:use-macros [reflex.macros :only [computed-observable constrain!]]) | ||
(:require [reflex.core :as [reflex]]) ;;need to explicitly require since macros reference this ns | ||
) | ||
|
||
|
||
(let [!counter (atom 0) | ||
!signal (atom "All I do is change")] | ||
|
||
(constrain! | ||
;;when I change... | ||
@!signal | ||
;;update the counter | ||
(swap! !counter inc)) | ||
|
||
(assert (= 1 @!counter) | ||
"Constraint run on init") | ||
|
||
(reset! !signal "foo") | ||
|
||
(assert (= 2 @!counter) | ||
"Counter auto updated")) | ||
|
||
|
||
|
||
(let [!x (atom 0) | ||
!co (computed-observable (inc @!x))] | ||
|
||
(assert (= 1 @!co) | ||
"CO has correct value on first deref") | ||
|
||
(swap! !x inc) | ||
|
||
(assert (= 2 @!co) | ||
"CO auto-updates")) | ||
|
||
|
||
|
||
|
||
|
||
(.log js/console "Hurray, all tests passed!") | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#Test runner for use with PhantomJS | ||
page = new WebPage() | ||
page.onConsoleMessage = (msg) -> console.log msg | ||
|
||
page.onLoadFinished = -> | ||
page.injectJs "out/test/integration.js" | ||
phantom.exit() | ||
|
||
page.open "about:blank" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<html lang='en'> | ||
<head> | ||
<meta charset='utf-8' /> | ||
<title>Test</title> | ||
</head> | ||
<body> | ||
<script src='../../out/test/integration.js'></script> | ||
</body> | ||
</html> |