lundi 27 juin 2016

Ember unit test rendering handlebars returns null or undefined

I am trying to write unit tests for rendering a handlebar component. When the test gets ran the object is empty and no HTML is generated. I have followed this same layout using other components and they render properly. I am confused why the returned object is null/undefined

here is my ember test code:

import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';

moduleForComponent('csv-upload', 'Integration | Component | csv upload', {
     integration: true
});

test('it renders', function(assert) {
assert.expect(2);


this.render(hbs``);

assert.equal(this.$().text().trim(), '');

// Template block usage:
this.render(hbs`
  
   template block text
  
`);

assert.equal(this.$().text().trim(), '');
});

the output from the test is:

ok 32 PhantomJS 2.1 - JSHint - integration/pods/components/csv-upload/component-test.js: should pass jshint
not ok 33 PhantomJS 2.1 - Integration | Component | device actions: it renders
---
    actual: >
        null

another thing from output:

undefined is not an object (evaluating 'this.get('selected').isAny')




Aucun commentaire:

Enregistrer un commentaire