bensu / cljs-react-test Goto Github PK
View Code? Open in Web Editor NEWA ClojureScript wrapper around Reacts Test Utilities
A ClojureScript wrapper around Reacts Test Utilities
Hi, i have installed slimerjs and tried to run your tests but a dependency is missing:
[org.omcljs/om "0.9.0"]
Also when i add the dependency i get this:
$ lein doo slimer test
Building ...
Analyzing jar:file:/Users/bago/.m2/repository/org/clojure/clojurescript/0.0-3308/clojurescript-0.0-3308.jar!/cljs/core.cljs
Compiling src/cljs_react_test/simulate.cljs
Compiling src/cljs_react_test/utils.cljs
Analyzing jar:file:/Users/bago/.m2/repository/prismatic/dommy/1.0.0/dommy-1.0.0.jar!/dommy/core.cljs
Analyzing jar:file:/Users/bago/.m2/repository/prismatic/dommy/1.0.0/dommy-1.0.0.jar!/dommy/utils.cljs
Analyzing jar:file:/Users/bago/.m2/repository/org/clojure/clojurescript/0.0-3308/clojurescript-0.0-3308.jar!/clojure/string.cljs
Compiling test/basic.cljs
Analyzing jar:file:/Users/bago/.m2/repository/org/omcljs/om/0.8.8/om-0.8.8.jar!/om/dom.cljs
Analyzing jar:file:/Users/bago/.m2/repository/org/clojure/clojurescript/0.0-3308/clojurescript-0.0-3308.jar!/cljs/test.cljs
Analyzing jar:file:/Users/bago/.m2/repository/org/clojure/core.async/0.1.346.0-17112a-alpha/core.async-0.1.346.0-17112a-alpha.jar!/cljs/core/async.cljs
Analyzing jar:file:/Users/bago/.m2/repository/org/clojure/core.async/0.1.346.0-17112a-alpha/core.async-0.1.346.0-17112a-alpha.jar!/cljs/core/async/impl/channels.cljs
Analyzing jar:file:/Users/bago/.m2/repository/org/clojure/core.async/0.1.346.0-17112a-alpha/core.async-0.1.346.0-17112a-alpha.jar!/cljs/core/async/impl/dispatch.cljs
Analyzing jar:file:/Users/bago/.m2/repository/org/clojure/core.async/0.1.346.0-17112a-alpha/core.async-0.1.346.0-17112a-alpha.jar!/cljs/core/async/impl/buffers.cljs
Analyzing jar:file:/Users/bago/.m2/repository/org/clojure/core.async/0.1.346.0-17112a-alpha/core.async-0.1.346.0-17112a-alpha.jar!/cljs/core/async/impl/protocols.cljs
Analyzing jar:file:/Users/bago/.m2/repository/org/clojure/core.async/0.1.346.0-17112a-alpha/core.async-0.1.346.0-17112a-alpha.jar!/cljs/core/async/impl/ioc_helpers.cljs
Analyzing jar:file:/Users/bago/.m2/repository/org/clojure/core.async/0.1.346.0-17112a-alpha/core.async-0.1.346.0-17112a-alpha.jar!/cljs/core/async/impl/timers.cljs
Analyzing jar:file:/Users/bago/.m2/repository/org/omcljs/om/0.8.8/om-0.8.8.jar!/om/core.cljs
Compiling test/test_runner.cljs
Analyzing jar:file:/Users/bago/.m2/repository/doo/doo/0.1.2-SNAPSHOT/doo-0.1.2-SNAPSHOT.jar!/doo/runner.cljs
Compiling /Users/bago/Documents/code/cljs-react-test/target/cljsbuild-compiler-0/cljs/test.cljs
Compiling /Users/bago/Documents/code/cljs-react-test/target/cljsbuild-compiler-0/clojure/string.cljs
Compiling /Users/bago/Documents/code/cljs-react-test/target/cljsbuild-compiler-0/om/dom.cljs
Compiling /Users/bago/Documents/code/cljs-react-test/target/cljsbuild-compiler-0/dommy/core.cljs
Compiling /Users/bago/Documents/code/cljs-react-test/target/cljsbuild-compiler-0/dommy/utils.cljs
Compiling /Users/bago/Documents/code/cljs-react-test/target/cljsbuild-compiler-0/doo/runner.cljs
Compiling /Users/bago/Documents/code/cljs-react-test/target/cljsbuild-compiler-0/om/core.cljs
Compiling /Users/bago/Documents/code/cljs-react-test/target/cljsbuild-compiler-0/cljs/core/async.cljs
Compiling /Users/bago/Documents/code/cljs-react-test/target/cljsbuild-compiler-0/cljs/core/async/impl/timers.cljs
Compiling /Users/bago/Documents/code/cljs-react-test/target/cljsbuild-compiler-0/cljs/core/async/impl/ioc_helpers.cljs
Compiling /Users/bago/Documents/code/cljs-react-test/target/cljsbuild-compiler-0/cljs/core/async/impl/protocols.cljs
Compiling /Users/bago/Documents/code/cljs-react-test/target/cljsbuild-compiler-0/cljs/core/async/impl/buffers.cljs
Compiling /Users/bago/Documents/code/cljs-react-test/target/cljsbuild-compiler-0/cljs/core/async/impl/dispatch.cljs
Compiling /Users/bago/Documents/code/cljs-react-test/target/cljsbuild-compiler-0/cljs/core/async/impl/channels.cljs
Compiling /Users/bago/Documents/code/cljs-react-test/target/cljsbuild-compiler-0/cljs/core.cljs
Applying optimizations :whitespace
Jul 14, 2015 6:30:47 PM com.google.javascript.jscomp.LoggerErrorManager println
SEVERE: ERROR - Duplicate extern input: file:/Users/bago/.m2/repository/cljsjs/react/0.12.2-5/react-0.12.2-5.jar!/cljsjs/common/react.ext.js
Jul 14, 2015 6:30:47 PM com.google.javascript.jscomp.LoggerErrorManager printSummary
WARNING: 1 error(s), 0 warning(s)
ERROR: JSC_DUPLICATE_EXTERN_INPUT. Duplicate extern input: file:/Users/bago/.m2/repository/cljsjs/react/0.12.2-5/react-0.12.2-5.jar!/cljsjs/common/react.ext.js at (unknown source) line (unknown line) : (unknown column)
... done. Elapsed 16.583571467 seconds
Watching paths: /Users/bago/Documents/code/cljs-react-test/src, /Users/bago/Documents/code/cljs-react-test/test
Duplicated external input: react.ext.js, any thought?
Thank you and great work!
I am having some difficulty updating to the latest versions. I created a example project that demonstrates the issue.
Tests run as desired when using
[cljsjs/react-with-addons "0.13.3-0"]
[cljs-react-test "0.1.3-SNAPSHOT"]
After updating dependencies to and making no other changes
[cljs-react-test "0.1.4-SNAPSHOT"]
[cljsjs/react-with-addons "15.2.0-0"]
[cljsjs/react-dom "15.2.0-0" :exclusions [cljsjs/react]]
[prismatic/dommy "1.1.0"]
The following error occurs
;; ======================================================================
;; Testing with Phantom:
TypeError: undefined is not an object (evaluating 'React.addons.TestUtils')
phantomjs://code/phantom966794781240370468.js:81 in onError
Am I overlooking something?
Hi there, I am trying to utilize cljs-react-test and dommy to change a dropdown menu choice which in turns updates the atom. However, it seems I am not doing this correctly. Here is what I have for code and my tests.
------ Component --------- in (ns. component.dropdown)
(defn dropdown [] [:div [:select {:on-change #(swap! app-state assoc :bind (.. % -target -value))} [:option {:value "1"} "1"] [:option {:value "2"} "2"] [:option {:value "3"} "3"] [:option {:value "4"} "4"]]])
------In Test file ------------
`(def ^:dynamic c)
(use-fixtures :each (fn [test-fn]
(binding [c (tu/new-container!)]
(test-fn)
(tu/unmount! c))))
(deftest dropdown-selection-appstate-on-change
(let [_ (reagent/render [cd/dropdown app-state] c)
node (sel1 c [:select])
dropdown-selection (:bind @App-State)]
(is (= "0" (:bind @App-State)))
(sim/change node {:target {:option {:value "3"}}})
(is (= "3" (:bind @App-State)))))`
----------Test read out-----------
FAIL in (dropdown-selection-appstate-on-change) (:)
expected: (= "3" (:bind (clojure.core/deref app-state)))
actual: (not (= "3" nil))
Every now and then I get the following error, nondeterministically:
java.lang.Exception: No namespace: camel-snake-kebab.core, compiling:(cljs_react_test/simulate.clj:1:1)
Perhaps something could be required in a better way? Otherwise what could it be going on?
Cheers - Victor
https://facebook.github.io/react/docs/test-utils.html
var ReactTestUtils = require('react-addons-test-utils');
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.