These are chat archives for canjs/canjs

27th
Jun 2016
Thomas Sieverding
@Bajix
Jun 27 2016 03:10
How does can-connect do the equivalent of can.Model.parseModel
nvm
Matthew Phillips
@matthewp
Jun 27 2016 11:33
arg, will fix the tag
qantourisc
@qantourisc
Jun 27 2016 14:24
Unsure what the best/correct way is to define an edit button on a model.
(in a #list)
I could do ($click}="edit(id)" but that implies I'd need to search for the desired model in the list. (Or is this normal procedure?)
Julian
@pYr0x
Jun 27 2016 14:42
time is good... will attend :)
qantourisc
@qantourisc
Jun 27 2016 14:45
A one can use %scope
I would however need to use %scope._parent , is is that ok ? or is there a correct wait to look into the parent ?
ok "../"
Dovid Bleier
@dbleier
Jun 27 2016 19:11
curious what people do about setting up test data? can-fixture seems to be tuned to ajax calls. But what about for non-ajax functions. For example, I am writing a unit test for a post-processing function, so it's not making the ajax call, rather it gets passed the response data (or a portion thereof). Is just using a direct call to store.get recommended? Or is there a better way?
Kevin Phillips
@phillipskevin
Jun 27 2016 19:15
you mean in your unit test, using the store that is exported from your fixture?
Dovid Bleier
@dbleier
Jun 27 2016 19:22
yes
Kevin Phillips
@phillipskevin
Jun 27 2016 19:25
that works, but you could also just import the data from a json file
import it into your fixture and into your test
I don’t know that either way is drastically better
Dovid Bleier
@dbleier
Jun 27 2016 19:38
how would you import a json file into the test?
Kevin Phillips
@phillipskevin
Jun 27 2016 19:40
you should just be able to import it
import myJson from ‘my-json-file.json’;
Dovid Bleier
@dbleier
Jun 27 2016 19:41
aha, cool thanks. I think I'll try that
do recommend keeping the json in the same folder as the test code or in the fixtures folder? I am guessing fixture makes more sense
Kevin Phillips
@phillipskevin
Jun 27 2016 19:43
probably in the fixtures folder, yeah
I put it in the modlet folder sometimes to use in demo files
Dovid Bleier
@dbleier
Jun 27 2016 19:44
also I have noticed that you (I think it's you) have been using mocha. So far I have just used qunit since it's the default and I am used to that style from other languages. What do you find preferential about mocha?
Kevin Phillips
@phillipskevin
Jun 27 2016 19:47
yeah, that’s me
there’s honestly not a huge difference
I mostly prefer mocha because of how they do async tests
the QUnit.start() stuff has always confused me
but you don’t even have to do that in qunit anymore I don’t think
Dovid Bleier
@dbleier
Jun 27 2016 19:49
ok, good to know. thanks again.
Kevin Phillips
@phillipskevin
Jun 27 2016 19:50
qunit / jasmine / mocha all basically have the same API now
you can use mocha directly in node
so that’s a huge benefit if you’re doing js on the server also
since you can use the same test style for both