josephg / ShareJS

Collaborative editing in any app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

json list move bug when called with path (0.7)

dgreisen opened this issue · comments

@tedsuo: could you take a look at this?

I added a bunch of tests for manipulating json with paths rather than contexts. I found a bug in move when called with a path (i've disabled the list move test for now). The test throws "TypeError: object is not a function". I cannot figure out why.
I also believe there is a typo in move at the line

if(cb) cb.apply(cb, arguments);

which I believe should be

if(cb) cb.apply(this, arguments);

but changing it doesn't fix the problem, and I wanted to be sure it is incorrect before changing it.

It'd be great to write a randomizer that exercised the JSON API.

Yeah, I won't be convinced that its correct until it has that.

Just saw this. @dgreisen do you still want me to take a look the move bug? If so can you post a gist of the failing test?

@dgreisen looks like the new test has a typo, there's a missing comma on the argument list here:
https://github.com/dgreisen/ShareJS/blob/api-normalize/test/json-api.coffee#L206

fixing that causes everything to pass. Were you seeing strange behavior elsewhere, or just in that test?

BTW, when you see an error like "TypeError: object is not a function" without a stack trace, it's because chrome and some other environments have crap console error logging sometimes (firefox is better about it). If you find the line logging the error and instead log error.stack you will see better output.

well I feel foolish. I guess that's why I couldn't figure out what was wrong with your code :).