Fork me on GitHub
#reagent
<
2015-07-18
>
jarrodctaylor16:07:11

Does anyone have an example of a tested reagent application that uses localStorage? PhantomJS doesn't seem to play nicely with localStorage in the reagent -template. I have unsuccessfully attempted to use slimerjs as a phantom alternative, but I must be missing something trying to wire it up.

gadfly36116:07:03

Not sure how you are doing local storage, but I recommend using https://github.com/alandipert/storage-atom

gadfly36116:07:42

I used that for the reagent todomvc and it passed their suite of tests

jarrodctaylor16:07:17

I am indeed using storage-atom. Works great in the app, I just can't manage to get tests to run when using it (or accessing localStorage directly)

gadfly36116:07:01

Ah dang, then I'm not sure what the problem is

jarrodctaylor16:07:49

Where is the todomvc example located? If that is tested perhaps that could point me in the right direction to see if I am just doing something improperly.

gadfly36116:07:39

However, that was passing Mocha tests I believe. I didn't include any clojurescript tests..

jarrodctaylor17:07:58

Ahh yeah I was hoping to use clojurescript.test

gadfly36117:07:40

Ive only used cljs.test and speclj before. I tried using clojurescript.test once and didnt set it up correctly with reagent. I should probably try again! Is there a repo you can point me to that has a working example with reagent?

jarrodctaylor17:07:31

The reagent-tempate actually comes setup with a working test if you create it with +test just do a lein new reagent <name> +test

jarrodctaylor17:07:12

I have had success writing tests for quite a few things, once the localStorage is added to the mix however a little tweaking is still required.

gadfly36117:07:19

Oh nice, yeah I'll try that. I tried a couple months ago, and I must've caught it when it was momentarily out of sync bc it wouldn't compile with that profile added.