These are chat archives for canjs/canjs

25th
Jan 2016
Justin Meyer
@justinbmeyer
Jan 25 2016 02:52
@whitecolor please submit an issue with any bugs you find.
Alex
@whitecolor
Jan 25 2016 03:18
@justinbmeyer of course
Justin Meyer
@justinbmeyer
Jan 25 2016 03:19
thanks!
Bryan Clover
@bclover
Jan 25 2016 14:28
Hello…I’m new to gitter and CanJS! I’m switching to CanJS after years of AngularJS development and hoping this will be a good place to ask and get quick answers.
Guido Smeets
@gsmeets
Jan 25 2016 14:30
Hi and welcome
Gitter is ofc asynchronous, but there are canjs users in most timezones I reckon ;)
Bryan Clover
@bclover
Jan 25 2016 14:32
Thanks…@gsmeets. Hey would anyone on this channel happen to know where to find docs on how to configure StealJS, karma, jasmine? What is the “default” approach...and techs for unit testing CanJS?
Kevin Phillips
@phillipskevin
Jan 25 2016 14:47
@bclover here’s a forum post about setting up Karma + StealJS: http://forums.donejs.com/t/using-karma-to-test-stealjs/70
setting up Jasmine shouldn’t be any different than any other karma project
Kevin Phillips
@phillipskevin
Jan 25 2016 14:55
If you’re starting a new project, you might want to check out DoneJS - it combines CanJS and StealJS and comes with Testee and Mocha for unit testing.
you can obviously swap out any of the testing tools if you prefer something else, but that will basically show you the “default” approach.
and the guides walk through creating some good tests: http://donejs.com/place-my-order.html#section=section_Creatingaunit_testedviewmodel
Bryan Clover
@bclover
Jan 25 2016 15:23
Thank you @phillipskevin !
Kevin Phillips
@phillipskevin
Jan 25 2016 15:25
yeah, no problem
dylanrtt
@dylanrtt
Jan 25 2016 16:00
@justinbmeyer In the 2.3 release article, ({left})="right" should have curly braces on the outside
Justin Meyer
@justinbmeyer
Jan 25 2016 16:15
ah, thanks
Bryan Clover
@bclover
Jan 25 2016 16:34
This message was deleted
dylanrtt
@dylanrtt
Jan 25 2016 17:22
I am trying to pass a compute to a component with the ~ operator but I don't think it's working. Is the correct syntax?
http://jsbin.com/jajevuhadu/edit?html,js,console
Justin Meyer
@justinbmeyer
Jan 25 2016 18:54
@dylanrtt seems like a bug
though I'm not really sure what the behavior of something like that in a 2-way binding should be
passing a compute makes sense in 1-way, scope -> component
but if the component changes the compute it's foo points at ...
I don't think we can really update the scope's bar to that compute
Mohamed Cherif Bouchelaghem
@cherifGsoul
Jan 25 2016 18:56
@justinbmeyer for can-define 2 arrays in 2 diffrent object are always the same
Justin Meyer
@justinbmeyer
Jan 25 2016 18:56
that wouldn't make sense
@cherifGsoul ?
Mohamed Cherif Bouchelaghem
@cherifGsoul
Jan 25 2016 18:57
sorry press enter by error
@justinbmeyer what make them differents? CID?
Justin Meyer
@justinbmeyer
Jan 25 2016 18:58
is this a test or something?
you are working on?
Mohamed Cherif Bouchelaghem
@cherifGsoul
Jan 25 2016 18:58
yes
Justin Meyer
@justinbmeyer
Jan 25 2016 18:58
I'm not really sure what's the context here
Mohamed Cherif Bouchelaghem
@cherifGsoul
Jan 25 2016 18:58
1sec
@justinbmeyer I posted the test
Justin Meyer
@justinbmeyer
Jan 25 2016 19:00
so, that's breaking?
have you pushed your branch?
Mohamed Cherif Bouchelaghem
@cherifGsoul
Jan 25 2016 19:00
is already there
yes pushed
shoud we have a natif JS array or can.List in this case?
@justinbmeyer the branch is default_value
the problem is that defaultValue is going to be cached
for every instance :-(
we need to fix that somehow
Mohamed Cherif Bouchelaghem
@cherifGsoul
Jan 25 2016 19:04
ok
Justin Meyer
@justinbmeyer
Jan 25 2016 19:04
there are several ways .... but I'm not sure the best
a dirty hack way would be for us to look at this.__hasBeenSet, this.__defaultValueRetrieved etc
but that's gross
the best way would actually be to overwrite can.Map's ___get method
actually ... I take that back ....
well ...
I was thinking of changing ___get to check if this.__data.hasOwnProperty(prop)
if it doesn't, then go get the default value
I was going to say that this doesn't work becuase if someone runs map.removeAttr(prop) it would then remove the prop
buuuut ... as there's no delete hook, delete obj.prop won't work anyway with can-define
maybe for now ... we can have a __meta object
and we could check map.__meta[prop].hasBeenSet
at least as a way of making things a little less gross
Dovid Bleier
@dbleier
Jan 25 2016 19:33
how does one get a direct handle to the superMap cache? For example to deleteData or clear? I don't see anything on the superMap instance or the can/Map instance
also how to unit test changes to server data with fixtures?
Mohamed Cherif Bouchelaghem
@cherifGsoul
Jan 25 2016 19:35
@justinbmeyer map.___metawill be added to the can.Map or the new can-define?
Justin Meyer
@justinbmeyer
Jan 25 2016 21:57
@cherifGsoul to the can-define'd objects
similar to how __data is added
Updated the can.stache key's page: http://canjs.com/docs/can.stache.key.html
Mohamed Cherif Bouchelaghem
@cherifGsoul
Jan 25 2016 22:55
@justinbmeyer thanks