Context default value is for cases without provider

This commit is contained in:
Juho Teperi 2018-05-04 18:14:48 +03:00
parent cb02310b68
commit 0c0ffc626a
1 changed files with 3 additions and 7 deletions

View File

@ -1197,16 +1197,12 @@
(fn [v] (fn [v]
(r/as-element [:div "Context: " v]))))))) (r/as-element [:div "Context: " v])))))))
;; FIXME: Why doesn't this work
#_
(testing "context default value works" (testing "context default value works"
(is (= "<div>Context: default</div>" (is (= "<div>Context: default</div>"
(rstr (r/create-element (rstr (r/create-element
Provider #js {} Consumer #js {}
(r/create-element (fn [v]
Consumer #js {} (r/as-element [:div "Context: " v])))))))
(fn [v]
(r/as-element [:div "Context: " v]))))))))
(testing "context works with adapt-react-class" (testing "context works with adapt-react-class"
(let [provider (r/adapt-react-class Provider) (let [provider (r/adapt-react-class Provider)