Skip to content

Commit

Permalink
Switch to React 15.0.0-0
Browse files Browse the repository at this point in the history
  • Loading branch information
r0man committed Apr 11, 2016
1 parent 4370e0a commit 2ab3cee
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 21 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.org
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
* Changelog

** 0.7.0

- [[https://github.com/r0man/sablono/pull/117][#117]] Switch to React 15.0.

** 0.6.3

- [[https://github.com/r0man/sablono/issues/115][#115]] Fix keyword compilation in attributes
- [[https://github.com/r0man/sablono/issues/115][#115]] Fix keyword compilation in attributes.

** 0.6.2

Expand Down
6 changes: 3 additions & 3 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
provide the dependencies yourself like this:

#+BEGIN_SRC clojure :exports code :results silent
[cljsjs/react "0.14.3-0"]
[cljsjs/react-dom "0.14.3-1"]
[cljsjs/react "15.0.0-0"]
[cljsjs/react-dom "15.0.0-0"]
#+END_SRC

If you want to do server rendering and use the =render= or
=render-static= functions from the =sablono.server= namespace you
need to add the following dependency as well:

#+BEGIN_SRC clojure :exports code :results silent
[cljsjs/react-dom-server "0.14.3-0"]
[cljsjs/react-dom-server "15.0.0-0"]
#+END_SRC

** Usage
Expand Down
20 changes: 10 additions & 10 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
(defproject sablono "0.6.4-SNAPSHOT"
(defproject sablono "0.7.0-SNAPSHOT"
:description "Lisp style templating for Facebook's React."
:url "http://github.com/r0man/sablono"
:author "r0man"
:min-lein-version "2.0.0"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[cljsjs/react "0.14.3-0" :scope "provided"]
[cljsjs/react-dom "0.14.3-1" :scope "provided"]
[cljsjs/react-dom-server "0.14.3-0" :scope "provided"]
:dependencies [[cljsjs/react "15.0.0-0" :scope "provided"]
[cljsjs/react-dom "15.0.0-0" :scope "provided"]
[cljsjs/react-dom-server "15.0.0-0" :scope "provided"]
[org.clojure/clojure "1.8.0" :scope "provided"]
[org.clojure/clojurescript "1.7.228" :scope "provided"]]
[org.clojure/clojurescript "1.8.40" :scope "provided"]]
:aliases {"ci" ["do"
["clean"]
["test" ":default"]
Expand Down Expand Up @@ -51,18 +51,18 @@
:verbose true}
:source-paths ["src" "test"]}]}
:deploy-repositories [["releases" :clojars]]
:profiles {:dev {:dependencies [[cljsjs/jquery "2.1.4-0"]
:profiles {:dev {:dependencies [[cljsjs/jquery "2.2.2-0"]
[crate "0.2.5"]
[criterium "0.4.3"]
[criterium "0.4.4"]
[devcards "0.2.1-6" :exclusions [sablono]]
[doo "0.1.6"]
[figwheel-sidecar "0.5.0-6"]
[figwheel-sidecar "0.5.2"]
[hickory "0.6.0"]
[reagent "0.6.0-alpha"]
[rum "0.6.0"]]
:plugins [[lein-cljsbuild "1.1.2"]
:plugins [[lein-cljsbuild "1.1.3"]
[lein-doo "0.1.6"]
[lein-figwheel "0.5.0-6"]]
[lein-figwheel "0.5.2"]]
:resource-paths ["test-resources" "target"]}
:repl {:dependencies [[com.cemerick/piggieback "0.2.1"]]
:repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}}}
Expand Down
8 changes: 4 additions & 4 deletions src/sablono/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
[:input {:type type
:name (make-name name)
:id (make-id name)
:value value}])
:value (or value js/undefined)}])

(gen-input-fields)

Expand All @@ -102,7 +102,7 @@
[:input {:type "checkbox"
:name (make-name name)
:id (make-id name)
:value value
:value (or value js/undefined)
:checked checked?}]))

(defelem radio-button
Expand All @@ -113,7 +113,7 @@
[:input {:type "radio"
:name (make-name group)
:id (make-id (str (as-str group) "-" (as-str value)))
:value value
:value (or value js/undefined)
:checked checked?}]))

(defn- hash-key [x]
Expand Down Expand Up @@ -157,7 +157,7 @@
[:textarea
{:name (make-name name)
:id (make-id name)
:value value}]))
:value (or value js/undefined)}]))

(defelem label
"Creates a label for an input field with the supplied name."
Expand Down
2 changes: 1 addition & 1 deletion src/sablono/interpreter.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
(let [props #js {}]
(gobject/extend
props (.-props this)
#js {:value (aget (.-state this) "value")
#js {:value (or (aget (.-state this) "value") js/undefined)
:onChange (aget this "onChange")
:children (aget (.-props this) "children")})
(ctor props))))}))))
Expand Down
4 changes: 2 additions & 2 deletions test/sablono/server_test.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
(are [markup match]
(re-matches (re-pattern match) (server/render markup))
(html [:div#a.b "c"])
"<div id=\"a\" class=\"b\" data-reactid=\".*\" data-react-checksum=\".*\">c</div>"
"<div id=\"a\" class=\"b\" data-reactroot=\"\" data-reactid=\".*\" data-react-checksum=\".*\">c</div>"
(html [:div (when true [:p "data"]) (if true [:p "data"] nil)])
"<div data-reactid=\".*\" data-react-checksum=\".*\"><p data-reactid=\".*\">data</p><p data-reactid=\".*\">data</p></div>"))
"<div data-reactroot=\"\" data-reactid=\".*\" data-react-checksum=\".*\"><p data-reactid=\".*\">data</p><p data-reactid=\".*\">data</p></div>"))

(deftest test-render-static
(are [markup expected]
Expand Down

0 comments on commit 2ab3cee

Please sign in to comment.