Fork me on GitHub
#reagent
<
2018-07-04
>
mhuebert10:07:11

@souenzzo here is my approach for using material-ui’s CSS-in-JS with Reagent: https://gist.github.com/mhuebert/4e3af2fbc33b40e74539487e50110a14 I wrote a let macro which delegates to a wrapped version of withStyles, which I find succinct and readable:

(:require [material-ui.styles :as m])

;; ...in a component somewhere
(m/let [{:keys [leftPad]} (fn [^js theme]
                               {:leftPad 
                                 {:paddingLeft (.. theme -spacing -unit)}})]
  [my-component {:class leftPad} ...])

👍 16
dfcarpenter18:07:33

Has anyone played with or know how (or if) I could integrate https://css-blocks.com/ with a reagent project?

urbanslug21:07:02

Hey, I can't find resources on testing reagent code. Could someone point me to something or tell me how this would work?

leblowl23:07:55

I have never actually testing my Reagent code via code - I just test it by hand in the browser. But I have some ideas: • You can write most Reagent component pieces as pure functions and test the Hiccup-like return values • You may be able to use a JS React testing library like https://jestjs.io directly (not sure if CLJS has a wrapper, but I couldn't find one) • Write state changing code in separate functions from your Reagent components and unit/integration test the functions • Not really related to Reagent, but I found this for Om-Next: https://github.com/omcljs/om/wiki/Applying-Property-Based-Testing-to-User-Interfaces ... Might be something to learn from (didn't read through it all) • There is also Selenium which has been around for a while and applies to generic website testing (https://docs.seleniumhq.org/) Hope that helps a little

nenadalm04:07:31

I don't write unit tests for reagent. I am testing it using webdriver protocol via https://github.com/igrishaev/etaoin.