These are chat archives for canjs/canjs

Feb 2015
Luis Merino
Feb 18 2015 20:21
@justinbmeyer I found easy to test can.js except components, because I am building a big template that contains multiple child components, and to test out some functionality it's hard to isolate a component.
Any advice you can give me to make testing easier?
Of course I could compose my own templates for each test so that I leave out other child components, but that would defeat the purpose because it would not be very maintenable and prone to errors (templates may differ from tests at some point)
Gerard Finnerty
Feb 18 2015 21:52
I used a lot of components within components. What problem are you having with testing them specifically? Every component would have a corresponding test suite... If you're writing modules, you're loading all subcomponents from the parent anyways. If your test is on the parent, there's no reason to test the functionality of the child components, even if they're included... components should be self-contained, so anything a child receives from a parent should be passed as arguments in the child's tag anyways...

describe('Some component', function( ) {

var $component;

beforeEach(function( done ) {
  System.import('shared/services/account/fixture').then(function( ) {
    ]).then(function (values){
      var can  = values[0];

      var template = can.stache('<some-component/>');
      $component = $('some-component');


it('should have a scope', function() {

afterEach(function() {


That's a basic test setup of a component that checks for the scope, that's what I use in my yeoman generator for the component.test.js when generating a new component
I don't use funcunit though