For a component where I have a textbox, I need to be able to change the text in it from the test:
(defn choose-city-component []
(let [inner-state (r/atom {:text ""})]
(fn []
[:div
[:input#txt_city {
:type "text"
:value (@inner-state :text)
:on-change #(swap! inner-state assoc :text (-> % .-target .-value))...
In the test I render it on the screen:
(deftest choose-city-component-test-out
;;GIVEN render component in test
(let [comp (r/render-component [w/choose-city-component]
(. js/document (getElementById "test")))]
;;WHEN changing the city....
Now using jQuery trigger I'm trying to simulate an onChange on the text:
We tried
(.change ($ :#txt_city) {"target" {"value" "Paris"}})
and
(.trigger ($ :#txt_city) "change" {"target" {"value" "Paris"}}))
But it doesn't work...