These are chat archives for canjs/canjs

26th
Jul 2016
Mason Shin
@minsooshin
Jul 26 2016 18:20
is there a way I can import something to use can.ajax instead of import entire can?
I can import can/model/ to use model
I think can.ajax is under can/util/, but I cannot find it
Dovid Bleier
@dbleier
Jul 26 2016 18:47
I had asked this once before, how to test an "inserted" event and was told to insert the component into the dom. So I tried $('body').append('<current-slideshow></current-slideshow>'); in my test where current-slideshow is the tag name for the component. But it did not trigger the "inserted" event. So how can I do it?
Mason Shin
@minsooshin
Jul 26 2016 18:48
in your main component, did you import the current-slideshow component?
even though you append the custom dom, it won’t call the component unless you import the component
Dovid Bleier
@dbleier
Jul 26 2016 18:50
what do you mean by "main" component? It's imported in it's parent component but is several layers deep from the top-level component
Kevin Phillips
@phillipskevin
Jul 26 2016 18:50
somewhere in your test
Mason Shin
@minsooshin
Jul 26 2016 18:50
where you define the body element
Dovid Bleier
@dbleier
Jul 26 2016 18:51
I didn't define body anywhere, just using the natural body element of the page running the qunit tests
which is test.html
Kevin Phillips
@phillipskevin
Jul 26 2016 18:51
in your test, are you importing the file that defines the component?
Mason Shin
@minsooshin
Jul 26 2016 18:51
then, you need to import the component in your test file
Dovid Bleier
@dbleier
Jul 26 2016 18:52
import { ViewModel } from './current-slideshow'; this is what I import into the test file
Kevin Phillips
@phillipskevin
Jul 26 2016 18:52
does that file also do the can.Component.extend({ … ?
Dovid Bleier
@dbleier
Jul 26 2016 18:53
yes, it's the default export
Mason Shin
@minsooshin
Jul 26 2016 18:54
I think you need to use can.stache,
Dovid Bleier
@dbleier
Jul 26 2016 18:54
do I need a separate import statement for the component?
Mason Shin
@minsooshin
Jul 26 2016 18:54
$('body').append(can.stache('<current-slideshow></current-slideshow>’));
something like this
Dovid Bleier
@dbleier
Jul 26 2016 18:54
ok, I'll try that
yes, that worked. thanks!
Mason Shin
@minsooshin
Jul 26 2016 18:56
np
Thomas Sieverding
@Bajix
Jul 26 2016 20:38
This message was deleted