mirror of https://github.com/status-im/reagent.git
Skip tests that require browser on node
This commit is contained in:
parent
d3ee4a7f8b
commit
cd0863f1b2
|
@ -909,54 +909,54 @@
|
||||||
(is (thrown-with-msg?
|
(is (thrown-with-msg?
|
||||||
:default #"Invalid tag: 'p.'"
|
:default #"Invalid tag: 'p.'"
|
||||||
(rstr [:p.])))
|
(rstr [:p.])))
|
||||||
|
(when r/is-client
|
||||||
|
(let [comp1 (fn comp1 [x]
|
||||||
|
x)
|
||||||
|
comp2 (fn comp2 [x]
|
||||||
|
[comp1 x])
|
||||||
|
comp3 (fn comp3 []
|
||||||
|
(r/with-let [a (r/atom "foo")]
|
||||||
|
[:div (for [i (range 0 1)]
|
||||||
|
^{:key i} [:p @a])]))
|
||||||
|
comp4 (fn comp4 []
|
||||||
|
(for [i (range 0 1)]
|
||||||
|
[:p "foo"]))
|
||||||
|
nat ($ util/react createClass #js{:render (fn [])})
|
||||||
|
pkg "reagenttest.testreagent."
|
||||||
|
stack1 (str "in " pkg "comp1")
|
||||||
|
stack2 (str "in " pkg "comp2 > " pkg "comp1")
|
||||||
|
lstr (fn [& s] (list (apply str s)))
|
||||||
|
re (fn [& s]
|
||||||
|
(re-pattern (apply str s)))
|
||||||
|
rend (fn [x]
|
||||||
|
(with-mounted-component x identity))]
|
||||||
|
(let [e (debug/track-warnings
|
||||||
|
#(is (thrown-with-msg?
|
||||||
|
:default (re "Invalid tag: 'div.' \\(" stack2 "\\)")
|
||||||
|
(rend [comp2 [:div. "foo"]]))))]
|
||||||
|
(is (= e
|
||||||
|
{:error (lstr "Error rendering component (" stack2 ")")})))
|
||||||
|
|
||||||
(let [comp1 (fn comp1 [x]
|
(let [e (debug/track-warnings
|
||||||
x)
|
#(is (thrown-with-msg?
|
||||||
comp2 (fn comp2 [x]
|
:default (re "Invalid tag: 'div.' \\(" stack1 "\\)")
|
||||||
[comp1 x])
|
(rend [comp1 [:div. "foo"]]))))]
|
||||||
comp3 (fn comp3 []
|
(is (= e
|
||||||
(r/with-let [a (r/atom "foo")]
|
{:error (lstr "Error rendering component (" stack1 ")")})))
|
||||||
[:div (for [i (range 0 1)]
|
|
||||||
^{:key i} [:p @a])]))
|
|
||||||
comp4 (fn comp4 []
|
|
||||||
(for [i (range 0 1)]
|
|
||||||
[:p "foo"]))
|
|
||||||
nat ($ util/react createClass #js{:render (fn [])})
|
|
||||||
pkg "reagenttest.testreagent."
|
|
||||||
stack1 (str "in " pkg "comp1")
|
|
||||||
stack2 (str "in " pkg "comp2 > " pkg "comp1")
|
|
||||||
lstr (fn [& s] (list (apply str s)))
|
|
||||||
re (fn [& s]
|
|
||||||
(re-pattern (apply str s)))
|
|
||||||
rend (fn [x]
|
|
||||||
(with-mounted-component x identity))]
|
|
||||||
(let [e (debug/track-warnings
|
|
||||||
#(is (thrown-with-msg?
|
|
||||||
:default (re "Invalid tag: 'div.' \\(" stack2 "\\)")
|
|
||||||
(rend [comp2 [:div. "foo"]]))))]
|
|
||||||
(is (= e
|
|
||||||
{:error (lstr "Error rendering component (" stack2 ")")})))
|
|
||||||
|
|
||||||
(let [e (debug/track-warnings
|
(let [e (debug/track-warnings #(r/as-element [nat]))]
|
||||||
#(is (thrown-with-msg?
|
(is (re-find #"Using native React classes directly"
|
||||||
:default (re "Invalid tag: 'div.' \\(" stack1 "\\)")
|
(-> e :warn first))))
|
||||||
(rend [comp1 [:div. "foo"]]))))]
|
|
||||||
(is (= e
|
|
||||||
{:error (lstr "Error rendering component (" stack1 ")")})))
|
|
||||||
|
|
||||||
(let [e (debug/track-warnings #(r/as-element [nat]))]
|
(let [e (debug/track-warnings
|
||||||
(is (re-find #"Using native React classes directly"
|
#(rend [comp3]))]
|
||||||
(-> e :warn first))))
|
(is (re-find #"Reactive deref not supported"
|
||||||
|
(-> e :warn first))))
|
||||||
|
|
||||||
(let [e (debug/track-warnings
|
(let [e (debug/track-warnings
|
||||||
#(rend [comp3]))]
|
#(r/as-element (comp4)))]
|
||||||
(is (re-find #"Reactive deref not supported"
|
(is (re-find #"Every element in a seq should have a unique :key"
|
||||||
(-> e :warn first))))
|
(-> e :warn first))))))))
|
||||||
|
|
||||||
(let [e (debug/track-warnings
|
|
||||||
#(r/as-element (comp4)))]
|
|
||||||
(is (re-find #"Every element in a seq should have a unique :key"
|
|
||||||
(-> e :warn first)))))))
|
|
||||||
|
|
||||||
(deftest test-dom-node
|
(deftest test-dom-node
|
||||||
(let [node (atom nil)
|
(let [node (atom nil)
|
||||||
|
|
Loading…
Reference in New Issue