Fork me on GitHub

I've found, for the use of devcards: keeping the app-db isolated is not worth it.


What I do, is for a certain panel, I'll mount just that panel into a devcard, and another panel underneath.


the panel underneath has a few buttons that exercise the panel under test.


so for the login panel, it will fill fields via dispatch, try to submit via disaptch, etc.


basically a list of pure event vectors (like: [:update-signin :user "johnbo"]) that might look like this:


   [:update-signin :user "johnbo"]
   [:update-signin :email  ""]
   [:update-signin :pw1 "johnbo"]
   [:update-signin :pw2 "johnbo-notmatching"]


then a view simply has buttons with the vals of that structure, and when clicking the button, uses doseq and js/setTimeout to dispatch those events in that order.


@escherize: That sounds like a good approach, thanks! We had a bit more discussion in #C09GR9UJC as well if you are interested. I'm definitely going to experiment with the way you've been using devcards as I think it would be a really good fit for one of my older projects.


Hey, I have a beginner re-frame question: What’s the best way to preload an image I have access to before a component renders but not when my application starts? The ideas I've had are: * Use the js interop and create an image object as soon as I know the image URL which I could pass in to a my component at render time, but I don't know how to use an image object with Hiccups. * "Render" the component as soon as I know the image URL but set the style to "display=none". When I need to actually render the component update the display. Are there any better ones?


@zackbleach: I've ended up using the "display=none" route quite a few times for other situations and been pretty happy with it. It's much nicer doing it with re-frame than without, I've just set up a handler that fires when loading starts and another when it's ready to render. You might be able to adapt some of the ideas from as there seems to be a bit of overlap there, but that might be a stretch.


@shaun-mahood: I've just set up a handler that fires when loading starts and another when it's ready to render that’s exactly what I going to do (good to know I’m thinking about this in the right way). Thanks for the link!


@zackbleach: No problem, keep on asking if you've got more questions - it's a really friendly and helpful channel.