These are chat archives for canjs/canjs

8th
Dec 2017
Viktor Busko
@Lighttree
Dec 08 2017 13:27
Guys, am I right that can.js has its own virtual dom implementation similar to React? Based on this https://donejs.com/Features.html#worker-thread-rendering it seems like it has (unless this is DoneJS feature). But based on description here: https://canjs.com/doc/can-vdom.html this is different thing (maybe just mess with terms). My question is... it there any plans or possibility to do shallow rendering for can.js similar to: https://reactjs.org/docs/shallow-renderer.html. The purpose is the same - testing.
Kevin Phillips
@phillipskevin
Dec 08 2017 15:32
We have virtual dom for server-side rendering, @Lighttree. It's not used when rendering client-side.
You could use it for tests though - we do that in can-stache and a few other libraries.
to make sure they work in the real DOM and VDOM
we don't currently have a plan to do any kind of shallow rendering
but you can always submit a proposal
that would be really cool
Justin Meyer
@justinbmeyer
Dec 08 2017 15:46
@phillipskevin that's an interesting idea ... ideally, we'd make all custom elements use Scope to find the custom tag ... what's suggested would be a matter of making a scope that doesn't "look" for globally registered tags.
Trickier if you are importing.
Brad Momberger
@bmomberger-bitovi
Dec 08 2017 15:58
For testing in isolation, you can do a shallow render of components by replacing can-view-callbacks._tags with an empty object after every test -- the effect will be to not render content for any custom tag (including can-components) that you don't define in the test itself. We have a limited form of this in the can-stache-bindings tests (deleting individual tag handlers) but the crude way is easiest.
Chasen Le Hara
@chasenlehara
Dec 08 2017 16:30
Our bi-weekly contributors meeting live-stream will start in just a few minutes! https://www.youtube.com/watch?v=LMf8ZSRFR4o