From cd0863f1b27910dd348fd5da04c4b0b19e4be9e9 Mon Sep 17 00:00:00 2001 From: Dan Holmsand Date: Fri, 27 May 2016 13:14:35 +0200 Subject: [PATCH] Skip tests that require browser on node --- test/reagenttest/testreagent.cljs | 88 +++++++++++++++---------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/test/reagenttest/testreagent.cljs b/test/reagenttest/testreagent.cljs index 76728d3..c84debd 100644 --- a/test/reagenttest/testreagent.cljs +++ b/test/reagenttest/testreagent.cljs @@ -909,54 +909,54 @@ (is (thrown-with-msg? :default #"Invalid tag: '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] - 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 [e (debug/track-warnings + #(is (thrown-with-msg? + :default (re "Invalid tag: 'div.' \\(" stack1 "\\)") + (rend [comp1 [:div. "foo"]]))))] + (is (= e + {:error (lstr "Error rendering component (" stack1 ")")}))) - (let [e (debug/track-warnings - #(is (thrown-with-msg? - :default (re "Invalid tag: 'div.' \\(" stack1 "\\)") - (rend [comp1 [:div. "foo"]]))))] - (is (= e - {:error (lstr "Error rendering component (" stack1 ")")}))) + (let [e (debug/track-warnings #(r/as-element [nat]))] + (is (re-find #"Using native React classes directly" + (-> e :warn first)))) - (let [e (debug/track-warnings #(r/as-element [nat]))] - (is (re-find #"Using native React classes directly" - (-> e :warn first)))) + (let [e (debug/track-warnings + #(rend [comp3]))] + (is (re-find #"Reactive deref not supported" + (-> e :warn first)))) - (let [e (debug/track-warnings - #(rend [comp3]))] - (is (re-find #"Reactive deref not supported" - (-> 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))))))) + (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 (let [node (atom nil)