Add test for force-update-all

This commit is contained in:
Dan Holmsand 2014-12-09 12:58:30 +01:00
parent 2c2eb9960f
commit 0e8ca42a37
1 changed files with 11 additions and 5 deletions

View File

@ -45,8 +45,12 @@
(with-mounted-component [really-simple nil nil] (with-mounted-component [really-simple nil nil]
(fn [c div] (fn [c div]
(swap! ran inc) (swap! ran inc)
(is (found-in #"div in really-simple" div)))) (is (found-in #"div in really-simple" div))
(is (= 2 @ran))))) (reagent/flush)
(is (= 2 @ran))
(reagent/force-update-all)
(is (= 3 @ran))))
(is (= 3 @ran)))))
(deftest test-simple-callback (deftest test-simple-callback
(when isClient (when isClient
@ -93,8 +97,7 @@
(reagent/set-state @self {:foo "you"}) (reagent/set-state @self {:foo "you"})
(rflush) (rflush)
(is (found-in #"hi you" div)) (is (found-in #"hi you" div))))
))
(is (= 4 @ran))))) (is (= 4 @ran)))))
(deftest test-ratom-change (deftest test-ratom-change
@ -223,7 +226,10 @@
(is (= @child-ran 6)) (is (= @child-ran 6))
(do (reset! child-props {:on-change (reagent/partial f1)}) (do (reset! child-props {:on-change (reagent/partial f1)})
(rflush)) (rflush))
(is (= @child-ran 7))))))) (is (= @child-ran 7))
(reagent/force-update-all)
(is (= @child-ran 8)))))))
(deftest dirty-test (deftest dirty-test
(when isClient (when isClient