Remove temporary :< tag

This commit is contained in:
Juho Teperi 2020-02-06 00:07:59 +02:00
parent 678e8adf7b
commit f0423a51f0
2 changed files with 4 additions and 15 deletions

View File

@ -311,11 +311,6 @@
(set! (.-key jsprops) key)) (set! (.-key jsprops) key))
(react/createElement comp/functional-render jsprops)))) (react/createElement comp/functional-render jsprops))))
(defn reag-fun-element [v]
(let [tag (nth v 1)
argv (drop 2 v)]
(react/createElement comp/functional-render #js {:tag tag :argv argv})))
(defn fragment-element [argv] (defn fragment-element [argv]
(let [props (nth argv 1 nil) (let [props (nth argv 1 nil)
hasprops (or (nil? props) (map? props)) hasprops (or (nil? props) (map? props))
@ -377,9 +372,6 @@
(keyword-identical? :<> tag) (keyword-identical? :<> tag)
(fragment-element v) (fragment-element v)
(keyword-identical? :< tag)
(reag-fun-element v)
(hiccup-tag? tag) (hiccup-tag? tag)
(let [n (name tag) (let [n (name tag)
pos (.indexOf n ">")] pos (.indexOf n ">")]

View File

@ -1429,14 +1429,11 @@
(r/flush) (r/flush)
(is (= 3 @render))))))) (is (= 3 @render)))))))
;; :< creates functional component for now.
;; This is for testing only, hopefully functional component
;; can be the default later.
(deftest functional-component-poc-simple (deftest functional-component-poc-simple
(when r/is-client (when r/is-client
(let [c (fn [x] (let [c (fn [x]
[:span "Hello " x])] [:span "Hello " x])]
(with-mounted-component [:< c "foo"] (with-mounted-component [c "foo"]
(fn [c div] (fn [c div]
(is (nil? c) "Render returns nil for stateless components") (is (nil? c) "Render returns nil for stateless components")
(is (= "Hello foo" (.-innerText div)))))))) (is (= "Hello foo" (.-innerText div))))))))
@ -1451,7 +1448,7 @@
(let [[c set-count] (react/useState x)] (let [[c set-count] (react/useState x)]
(reset! set-count! set-count) (reset! set-count! set-count)
[:span "Count " c]))] [:span "Count " c]))]
(with-mounted-component [:< c 5] (with-mounted-component [c 5]
(fn [c div] (fn [c div]
(is (nil? c) "Render returns nil for stateless components") (is (nil? c) "Render returns nil for stateless components")
(is (= "Count 5" (.-innerText div))) (is (= "Count 5" (.-innerText div)))
@ -1463,7 +1460,7 @@
(let [count (r/atom 5) (let [count (r/atom 5)
c (fn [x] c (fn [x]
[:span "Count " @count])] [:span "Count " @count])]
(with-mounted-component [:< c 5] (with-mounted-component [c 5]
(fn [c div] (fn [c div]
(is (nil? c) "Render returns nil for stateless components") (is (nil? c) "Render returns nil for stateless components")
(is (= "Count 5" (.-innerText div))) (is (= "Count 5" (.-innerText div)))
@ -1482,7 +1479,7 @@
(let [[c set-count] (react/useState x)] (let [[c set-count] (react/useState x)]
(reset! set-count! set-count) (reset! set-count! set-count)
[:span "Counts " @r-count " " c]))] [:span "Counts " @r-count " " c]))]
(with-mounted-component [:< c 15] (with-mounted-component [c 15]
(fn [c div] (fn [c div]
(is (nil? c) "Render returns nil for stateless components") (is (nil? c) "Render returns nil for stateless components")
(is (= "Counts 3 15" (.-innerText div))) (is (= "Counts 3 15" (.-innerText div)))