Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handlebars error in component unit test #171

Closed
jasonblanchard opened this issue Feb 9, 2015 · 2 comments
Closed

Handlebars error in component unit test #171

jasonblanchard opened this issue Feb 9, 2015 · 2 comments

Comments

@jasonblanchard
Copy link

Hi all,

I just got liquid fire set up on my Ember app and everything looks good.

However, in a unit test for a component in which I'm using liquid-with, I'm getting this error:

Error: <(subclass of Ember.Component):ember307> Handlebars error: Could not find property 'liquid-with' on object <(subclass of Ember.Component):ember307>.
Error: <(subclass of Ember.Component):ember307> Handlebars error: Could not find property 'liquid-with' on object <(subclass of Ember.Component):ember307>.
    at new Error (native)
    at Error.EmberError (http://localhost:4200/assets/vendor.js:27463:23)
    at helperMissingHelper (http://localhost:4200/assets/vendor.js:20233:13)
    at Object.anonymous (http://localhost:4200/assets/writermortis.js:1109:341)
    at http://localhost:4200/assets/vendor.js:10901:33
    at CoreView.extend.render (http://localhost:4200/assets/vendor.js:55511:20)
    at EmberRenderer_createElement [as createElement] (http://localhost:4200/assets/vendor.js:52738:16)
    at EmberRenderer.Renderer_renderTree [as renderTree] (http://localhost:4200/assets/vendor.js:23840:24)
    at EmberRenderer.<anonymous> (http://localhost:4200/assets/vendor.js:23917:16)
    at DeferredActionQueues.invoke (http://localhost:4200/assets/vendor.js:13891:18)

I feel like the liquid-with helper isn't being registered properly in the test set up. I didn't see anything obvious in the docs...

I'm using ember-cli 0.1.12, ember 1.8.1.

Thanks!

edit:

Here's the test file, nearly boilerplate ember-cli except for the helper dependency:

import {
  moduleForComponent,
  test
} from 'ember-qunit';

moduleForComponent('editable-story-viewer', 'EditableStoryViewerComponent', {
  // specify the other units that are required for this test
  needs: ['helper:formatted-text']
});

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

  // creates the component instance
  var component = this.subject();
  equal(component._state, 'preRender');

  // appends the component to the page
  this.append();
  equal(component._state, 'inDOM');
});
@ef4
Copy link
Collaborator

ef4 commented Feb 13, 2015

Your test has the comment:

// specify the other units that are required for this test

That means you need to list liquid-with. And liquid-with itself has dependencies, so the full thing will be something like:

['helper:formatted-text', 'view:liquid-with', 'view:liquid-child', 'template:liquid-with', 'helper:with-apply']

I got that list from liquid-with's own unit tests. It's annoying that the test infrastructure doesn't do transitive dependencies automatically.

@ef4 ef4 closed this as completed Feb 13, 2015
@jasonblanchard
Copy link
Author

Thanks!

Looks like I also had to add helper:liquid-with in the needs array.

Is this documented anywhere? Or is this this something folks should just dig through the liquid-fire unit test files to figure out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants