Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to select (w/ Dommy) nested :option #9

Open
Wolfgang51 opened this issue Feb 14, 2018 · 0 comments
Open

Trying to select (w/ Dommy) nested :option #9

Wolfgang51 opened this issue Feb 14, 2018 · 0 comments

Comments

@Wolfgang51
Copy link

Hi there, I am trying to utilize cljs-react-test and dommy to change a dropdown menu choice which in turns updates the atom. However, it seems I am not doing this correctly. Here is what I have for code and my tests.

------ Component --------- in (ns. component.dropdown)
(defn dropdown [] [:div [:select {:on-change #(swap! app-state assoc :bind (.. % -target -value))} [:option {:value "1"} "1"] [:option {:value "2"} "2"] [:option {:value "3"} "3"] [:option {:value "4"} "4"]]])

------In Test file ------------
`(def ^:dynamic c)

(use-fixtures :each (fn [test-fn]
(binding [c (tu/new-container!)]
(test-fn)
(tu/unmount! c))))

(deftest dropdown-selection-appstate-on-change
(let [_ (reagent/render [cd/dropdown app-state] c)
node (sel1 c [:select])
dropdown-selection (:bind @App-State)]
(is (= "0" (:bind @App-State)))
(sim/change node {:target {:option {:value "3"}}})
(is (= "3" (:bind @App-State)))))`

----------Test read out-----------
FAIL in (dropdown-selection-appstate-on-change) (:)
expected: (= "3" (:bind (clojure.core/deref app-state)))
actual: (not (= "3" nil))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant