Fork me on GitHub
#reagent
<
2015-10-07
>
rohit07:10:56

@mikethompson: thanks! still working on improving my knowledge of the library and css3. As I am using re-com, hopefully contribute some of what I have learnt back into that library.

mikethompson08:10:44

@rohit I keeping wishing we had more in the way of animations / transitions, so I'm keen to see where you get to with this.

mikethompson08:10:56

In a previous life, we used Flex (Flash) and oh wow did we have a lot to play with there. I love the React way, but I do miss access to all the cool kids animation toys simple_smile

rohit08:10:00

i can see that. i think many people are now trying to address this issue. Twitter also release their library for addressing this issue in react: https://fabric.io/blog/introducing-the-velocityreact-library

rohit08:10:37

I am currently reviewing react-motion, but i’ll get to velocity-react as well

rohit08:10:02

From the blogpost: That being said, React and animation don’t actually play well together at first. There’s an impedance mis-match: React’s power stems from abstracting away the state transitions in your UIs (it does them quickly and correctly, enabling the declarative paradigm we’ve come to love), while animations live entirely within those state transitions

mikethompson08:10:19

I'll certainly be following progress with interest

smogg08:10:42

Hey guys. I have a question regarding testing the :on-click action. For example:

(deftest click-test
  (when browser?
    (let [component (fn [] [:div {:class "someclass"
                            :on-click #(println "something")}])]
      (with-mounted-component (component)
        (fn [c div]
          (let [d (.querySelector div ".someclass")]
            ;; :on-click println never fires
            (.trigger (js/jQuery d) "click")))))))
I borrowed the with-mounted-component part from Reagent tests: https://slack-redir.net/link?url=https%3A%2F%2Fgithub.com%2Freagent-project%2Freagent%2Fblob%2Fmaster%2Ftest%2Freagenttest%2Ftestreagent.cljs&amp;v=3 In the example, :on-click never fires (testing with phantomjs). How can I test this kind of thing?

smogg08:10:12

To make things more interesting, this actually works:

(deftest click-checkbox-test
  (when browser?
    (let [component (fn [] [:input {:type :checkbox 
                                    :class "someclass"
                                    :on-click #(println "something")}])]
      (with-mounted-component (component)
        (fn [c div]
          (let [d (.querySelector div "input")]
            ;; :on-click is fired
            (.trigger (js/jQuery d) "click")))))))